{
 "cells": [
  {
   "cell_type": "raw",
   "id": "fdf916d3",
   "metadata": {},
   "source": [
    "基于用户的推荐：\n",
    "    通过计算用户之间的相似性，来将相似的用户的事物推荐给用户，但是要注意用户已经有的就不再做推荐了\n",
    "步骤：\n",
    "    1.计算用户之间的相似性\n",
    "    2.再根据相似用户的事物推向用户推荐"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b040038e",
   "metadata": {},
   "source": [
    "1.读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "86eb00ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "#读取数据\n",
    "user_artists = pd.read_csv('./music/user_artists.dat',sep='\\t') #使用\\t分隔符读取文件\n",
    "artists = pd.read_csv('./music/artists.dat',sep='\\t',usecols=['id','name'])# 使用\\t读取文件，仅读id和name列\n",
    "# user_artists = user_artists.drop(axis=1,columns=['weight']) #删除user_artists中的weight列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "53b806cb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>userID</th>\n",
       "      <th>artistID</th>\n",
       "      <th>weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>51</td>\n",
       "      <td>13883</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>52</td>\n",
       "      <td>11690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>53</td>\n",
       "      <td>11351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2</td>\n",
       "      <td>54</td>\n",
       "      <td>10300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>55</td>\n",
       "      <td>8983</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   userID  artistID  weight\n",
       "0       2        51   13883\n",
       "1       2        52   11690\n",
       "2       2        53   11351\n",
       "3       2        54   10300\n",
       "4       2        55    8983"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_artists.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "27bdfd3b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>MALICE MIZER</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Diary of Dreams</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Carpathian Forest</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Moi dix Mois</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Bella Morte</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id               name\n",
       "0   1       MALICE MIZER\n",
       "1   2    Diary of Dreams\n",
       "2   3  Carpathian Forest\n",
       "3   4       Moi dix Mois\n",
       "4   5        Bella Morte"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "artists.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "ec930bb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>userID</th>\n",
       "      <th>weight</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>13883</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "      <td>228</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>27</td>\n",
       "      <td>85</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>28</td>\n",
       "      <td>10</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>62</td>\n",
       "      <td>528</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92829</th>\n",
       "      <td>2100</td>\n",
       "      <td>337</td>\n",
       "      <td>Nyktalgia</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92830</th>\n",
       "      <td>2100</td>\n",
       "      <td>297</td>\n",
       "      <td>Atsakau  niekadA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92831</th>\n",
       "      <td>2100</td>\n",
       "      <td>281</td>\n",
       "      <td>Domantas Razauskas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92832</th>\n",
       "      <td>2100</td>\n",
       "      <td>280</td>\n",
       "      <td>Atalyja</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92833</th>\n",
       "      <td>2100</td>\n",
       "      <td>263</td>\n",
       "      <td>Les Chants de Nihil</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>92834 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       userID  weight                 name\n",
       "0           2   13883          Duran Duran\n",
       "1           4     228          Duran Duran\n",
       "2          27      85          Duran Duran\n",
       "3          28      10          Duran Duran\n",
       "4          62     528          Duran Duran\n",
       "...       ...     ...                  ...\n",
       "92829    2100     337            Nyktalgia\n",
       "92830    2100     297     Atsakau  niekadA\n",
       "92831    2100     281   Domantas Razauskas\n",
       "92832    2100     280              Atalyja\n",
       "92833    2100     263  Les Chants de Nihil\n",
       "\n",
       "[92834 rows x 3 columns]"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 合并数据\n",
    "data = pd.merge(user_artists,artists,left_on='artistID',right_on='id')  #将user_artists、artists合并  left_on\\right_on为合并条件\n",
    "data = data.drop(['id','artistID'],axis=1)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "4367f49a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(92834, 3)"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fed3f45b",
   "metadata": {},
   "source": [
    "2.数据预处理"
   ]
  },
  {
   "cell_type": "raw",
   "id": "0dfc4426",
   "metadata": {},
   "source": [
    "python用dataframe筛选含有某些字段的行（contains和isin）\n",
    "筛选字符的（含有的形式):\n",
    "    df_new = df[df['地址'].str.contains(address)] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "94ffdc70",
   "metadata": {},
   "outputs": [],
   "source": [
    "counts = data['userID'].value_counts()   # 计算每个用户的评分次数\n",
    "data = data[data['userID'].isin(counts[counts >=50].index)] # 去除评分次数少于50次的用户\n",
    "counts = data['name'].value_counts() # 计算每个音乐的评分次数\n",
    "data = data[data['name'].isin(counts[counts >=50].index)] #除评分次数少于50次的音乐"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "c588a16c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>userID</th>\n",
       "      <th>weight</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>13883</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "      <td>228</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>27</td>\n",
       "      <td>85</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>28</td>\n",
       "      <td>10</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>62</td>\n",
       "      <td>528</td>\n",
       "      <td>Duran Duran</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63763</th>\n",
       "      <td>1998</td>\n",
       "      <td>255</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63764</th>\n",
       "      <td>2017</td>\n",
       "      <td>2690</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63765</th>\n",
       "      <td>2033</td>\n",
       "      <td>175</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63766</th>\n",
       "      <td>2076</td>\n",
       "      <td>203</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63767</th>\n",
       "      <td>2084</td>\n",
       "      <td>288</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>37891 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       userID  weight                name\n",
       "0           2   13883         Duran Duran\n",
       "1           4     228         Duran Duran\n",
       "2          27      85         Duran Duran\n",
       "3          28      10         Duran Duran\n",
       "4          62     528         Duran Duran\n",
       "...       ...     ...                 ...\n",
       "63763    1998     255  Cansei de Ser Sexy\n",
       "63764    2017    2690  Cansei de Ser Sexy\n",
       "63765    2033     175  Cansei de Ser Sexy\n",
       "63766    2076     203  Cansei de Ser Sexy\n",
       "63767    2084     288  Cansei de Ser Sexy\n",
       "\n",
       "[37891 rows x 3 columns]"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data[data['name'].isin(counts[counts >=50].index)]\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "938999eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(37891, 3)"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "89843485",
   "metadata": {},
   "outputs": [],
   "source": [
    "#将音乐和用户ID转换为数字\n",
    "#对音乐的处理\n",
    "name_to_index ={}\n",
    "index_to_name = {}\n",
    "for i,name in enumerate(data['name'].unique()): #遍历data中的name列\n",
    "    name_to_index[name] = i  #将name映射到数字\n",
    "    index_to_name[i] = name #将数字映射到name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "756eb644",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Duran Duran': 0,\n",
       " 'Air': 1,\n",
       " 'Kylie Minogue': 2,\n",
       " 'Daft Punk': 3,\n",
       " 'Goldfrapp': 4,\n",
       " 'New Order': 5,\n",
       " 'Röyksopp': 6,\n",
       " 'Coldplay': 7,\n",
       " 'Madonna': 8,\n",
       " 'Moby': 9,\n",
       " 'Dido': 10,\n",
       " 'Depeche Mode': 11,\n",
       " 'Portishead': 12,\n",
       " 'Gorillaz': 13,\n",
       " 'Lady Gaga': 14,\n",
       " 'Duffy': 15,\n",
       " 'Porcupine Tree': 16,\n",
       " 'Radiohead': 17,\n",
       " 'Robbie Williams': 18,\n",
       " 'Michael Jackson': 19,\n",
       " 'The Cure': 20,\n",
       " 'Enrique Iglesias': 21,\n",
       " 'Pink Floyd': 22,\n",
       " 'The Cranberries': 23,\n",
       " 'Garbage': 24,\n",
       " 'Placebo': 25,\n",
       " 'Scorpions': 26,\n",
       " 'Keane': 27,\n",
       " 'James Blunt': 28,\n",
       " 'a-ha': 29,\n",
       " 'Opeth': 30,\n",
       " 'Muse': 31,\n",
       " 'OneRepublic': 32,\n",
       " 'Tears for Fears': 33,\n",
       " 'Beirut': 34,\n",
       " 'System of a Down': 35,\n",
       " 'Arcade Fire': 36,\n",
       " 'Blur': 37,\n",
       " 'Damien Rice': 38,\n",
       " 'Beck': 39,\n",
       " 'Arctic Monkeys': 40,\n",
       " 'My Chemical Romance': 41,\n",
       " 'Bloc Party': 42,\n",
       " 'Bob Dylan': 43,\n",
       " 'Death Cab for Cutie': 44,\n",
       " 'Red Hot Chili Peppers': 45,\n",
       " 'Travis': 46,\n",
       " 'Modest Mouse': 47,\n",
       " 'Interpol': 48,\n",
       " 'Queens of the Stone Age': 49,\n",
       " 'The Beatles': 50,\n",
       " 'Kings of Leon': 51,\n",
       " 'The Killers': 52,\n",
       " 'Green Day': 53,\n",
       " 'Nine Inch Nails': 54,\n",
       " 'Nirvana': 55,\n",
       " 'Massive Attack': 56,\n",
       " 'Bob Marley': 57,\n",
       " 'Mariah Carey': 58,\n",
       " 'Céline Dion': 59,\n",
       " 'Janet Jackson': 60,\n",
       " 'Rihanna': 61,\n",
       " 'Britney Spears': 62,\n",
       " 'Jordin Sparks': 63,\n",
       " 'Kelly Clarkson': 64,\n",
       " 'Christina Aguilera': 65,\n",
       " 'Ashlee Simpson': 66,\n",
       " 'Leona Lewis': 67,\n",
       " 'Beyoncé': 68,\n",
       " 'Sugababes': 69,\n",
       " 'Lily Allen': 70,\n",
       " 'Jennifer Lopez': 71,\n",
       " 'Katy Perry': 72,\n",
       " 'Alicia Keys': 73,\n",
       " 'P!nk': 74,\n",
       " 'David Archuleta': 75,\n",
       " 'Black Eyed Peas': 76,\n",
       " 'Nelly Furtado': 77,\n",
       " 'Natasha Bedingfield': 78,\n",
       " 'Ciara': 79,\n",
       " 'Alanis Morissette': 80,\n",
       " 'Keri Hilson': 81,\n",
       " 'Hilary Duff': 82,\n",
       " 'Fergie': 83,\n",
       " 'Jonas Brothers': 84,\n",
       " 'The Saturdays': 85,\n",
       " 'Cobra Starship': 86,\n",
       " 'Ashley Tisdale': 87,\n",
       " 'JoJo': 88,\n",
       " 'Chris Brown': 89,\n",
       " 'David Guetta': 90,\n",
       " 'Justin Timberlake': 91,\n",
       " 'T.I.': 92,\n",
       " 'Kanye West': 93,\n",
       " 'Kelly Rowland': 94,\n",
       " 'Avril Lavigne': 95,\n",
       " 'Cher': 96,\n",
       " 'Colbie Caillat': 97,\n",
       " 'Taylor Swift': 98,\n",
       " 'The Pussycat Dolls': 99,\n",
       " 'Cheryl Cole': 100,\n",
       " 'Jason Mraz': 101,\n",
       " 'Jack Johnson': 102,\n",
       " 'Linkin Park': 103,\n",
       " 'Evanescence': 104,\n",
       " 'Cascada': 105,\n",
       " 'The All-American Rejects': 106,\n",
       " 'blink-182': 107,\n",
       " 'The National': 108,\n",
       " 'Sigur Rós': 109,\n",
       " 'Bat for Lashes': 110,\n",
       " 'The Strokes': 111,\n",
       " 'Yeah Yeah Yeahs': 112,\n",
       " 'The Libertines': 113,\n",
       " 'The Smiths': 114,\n",
       " 'Kate Nash': 115,\n",
       " 'Klaxons': 116,\n",
       " 'The Smashing Pumpkins': 117,\n",
       " 'Los Hermanos': 118,\n",
       " 'Animal Collective': 119,\n",
       " 'Joy Division': 120,\n",
       " 'Backstreet Boys': 121,\n",
       " 'Jesse McCartney': 122,\n",
       " 'Justin Bieber': 123,\n",
       " 'Miley Cyrus': 124,\n",
       " '3OH!3': 125,\n",
       " 'Jessica Simpson': 126,\n",
       " 'Ke$ha': 127,\n",
       " 'Usher': 128,\n",
       " '3 Doors Down': 129,\n",
       " 'Eminem': 130,\n",
       " 'Simple Plan': 131,\n",
       " 'Ne-Yo': 132,\n",
       " '30 Seconds to Mars': 133,\n",
       " 'Three Days Grace': 134,\n",
       " 'Limp Bizkit': 135,\n",
       " 'Papa Roach': 136,\n",
       " 'Paramore': 137,\n",
       " 'Flyleaf': 138,\n",
       " 'Bullet for My Valentine': 139,\n",
       " 'In Flames': 140,\n",
       " 'HIM': 141,\n",
       " 'U2': 142,\n",
       " 'Deftones': 143,\n",
       " 'Korn': 144,\n",
       " 'Within Temptation': 145,\n",
       " 'Lindsay Lohan': 146,\n",
       " 'Gwen Stefani': 147,\n",
       " 'La Roux': 148,\n",
       " 'Pixie Lott': 149,\n",
       " 'Taio Cruz': 150,\n",
       " 'Little Boots': 151,\n",
       " 'Oasis': 152,\n",
       " 'No Doubt': 153,\n",
       " 'Sophie Ellis-Bextor': 154,\n",
       " 'Good Charlotte': 155,\n",
       " 'The Used': 156,\n",
       " 'Maroon 5': 157,\n",
       " 'Fall Out Boy': 158,\n",
       " 'Pitty': 159,\n",
       " 'Nicole Scherzinger': 160,\n",
       " 'Adam Lambert': 161,\n",
       " 'The Ting Tings': 162,\n",
       " 'Ellie Goulding': 163,\n",
       " 'The Kinks': 164,\n",
       " 'The Who': 165,\n",
       " 'David Bowie': 166,\n",
       " 'Aphex Twin': 167,\n",
       " 'Kings of Convenience': 168,\n",
       " 'Pearl Jam': 169,\n",
       " 'Elliott Smith': 170,\n",
       " 'Belle and Sebastian': 171,\n",
       " 'Sufjan Stevens': 172,\n",
       " 'Explosions in the Sky': 173,\n",
       " 'RBD': 174,\n",
       " 'Glee Cast': 175,\n",
       " 'The Veronicas': 176,\n",
       " 'Demi Lovato': 177,\n",
       " 'John Mayer': 178,\n",
       " 'Selena Gomez & the Scene': 179,\n",
       " 'All Time Low': 180,\n",
       " 'Florence + the Machine': 181,\n",
       " 'Marina & the Diamonds': 182,\n",
       " 'Owl City': 183,\n",
       " 'Sia': 184,\n",
       " 'Shakira': 185,\n",
       " 'The xx': 186,\n",
       " 'The Pretty Reckless': 187,\n",
       " 'AC/DC': 188,\n",
       " 'Metallica': 189,\n",
       " 'The White Stripes': 190,\n",
       " 'Legião Urbana': 191,\n",
       " 'R.E.M.': 192,\n",
       " 'Kaiser Chiefs': 193,\n",
       " 'Johnny Cash': 194,\n",
       " 'Ozzy Osbourne': 195,\n",
       " 'Apocalyptica': 196,\n",
       " 'Eric Clapton': 197,\n",
       " 'Alice Cooper': 198,\n",
       " 'John Lennon': 199,\n",
       " 'The Rolling Stones': 200,\n",
       " 'Boards of Canada': 201,\n",
       " 'Crystal Castles': 202,\n",
       " 'Bring Me The Horizon': 203,\n",
       " 'Belinda': 204,\n",
       " 'Anahí': 205,\n",
       " 'Rise Against': 206,\n",
       " 'A Day to Remember': 207,\n",
       " 'Slayer': 208,\n",
       " 'Pantera': 209,\n",
       " 'Marilyn Manson': 210,\n",
       " 'Manic Street Preachers': 211,\n",
       " 'Alice in Chains': 212,\n",
       " 'The Clash': 213,\n",
       " 'Pixies': 214,\n",
       " 'The Velvet Underground': 215,\n",
       " 'The Doors': 216,\n",
       " 'Cyndi Lauper': 217,\n",
       " 'Tegan and Sara': 218,\n",
       " 'Amy Winehouse': 219,\n",
       " 'Girls Aloud': 220,\n",
       " 'Timbaland': 221,\n",
       " 'Vanessa Hudgens': 222,\n",
       " \"Destiny's Child\": 223,\n",
       " 'Iron Maiden': 224,\n",
       " 'Megadeth': 225,\n",
       " 'Dream Theater': 226,\n",
       " 'Children of Bodom': 227,\n",
       " 'Nightwish': 228,\n",
       " 'Bon Jovi': 229,\n",
       " 'Queen': 230,\n",
       " 'Tori Amos': 231,\n",
       " 'The Mars Volta': 232,\n",
       " 'Nickelback': 233,\n",
       " 'Kasabian': 234,\n",
       " 't.A.T.u.': 235,\n",
       " 'Disturbed': 236,\n",
       " 'Foo Fighters': 237,\n",
       " 'Pet Shop Boys': 238,\n",
       " 'Erasure': 239,\n",
       " 'Jessie J': 240,\n",
       " 'Kerli': 241,\n",
       " 'Nicki Minaj': 242,\n",
       " 'Bruno Mars': 243,\n",
       " 'Boys Like Girls': 244,\n",
       " 'Slipknot': 245,\n",
       " 'Fresno': 246,\n",
       " 'McFly': 247,\n",
       " 'The Kooks': 248,\n",
       " 'Ladytron': 249,\n",
       " 'IAMX': 250,\n",
       " 'Franz Ferdinand': 251,\n",
       " 'Björk': 252,\n",
       " 'The Prodigy': 253,\n",
       " 'Rammstein': 254,\n",
       " 'Phoenix': 255,\n",
       " 'Yann Tiersen': 256,\n",
       " 'Incubus': 257,\n",
       " 'A Perfect Circle': 258,\n",
       " 'Faith No More': 259,\n",
       " 'The Police': 260,\n",
       " 'Tool': 261,\n",
       " 'Escape The Fate': 262,\n",
       " 'Sum 41': 263,\n",
       " 'Misfits': 264,\n",
       " 'Weezer': 265,\n",
       " 'The Beach Boys': 266,\n",
       " 'Mika': 267,\n",
       " 'Elvis Presley': 268,\n",
       " 'Panic! At the Disco': 269,\n",
       " \"Guns N' Roses\": 270,\n",
       " 'Judas Priest': 271,\n",
       " 'Motörhead': 272,\n",
       " 'Black Sabbath': 273,\n",
       " 'Deep Purple': 274,\n",
       " 'Snow Patrol': 275,\n",
       " 'White Lies': 276,\n",
       " 'The Fray': 277,\n",
       " 'Hurts': 278,\n",
       " 'Vampire Weekend': 279,\n",
       " 'Justice': 280,\n",
       " 'MGMT': 281,\n",
       " 'The Offspring': 282,\n",
       " 'Led Zeppelin': 283,\n",
       " 'Paul McCartney': 284,\n",
       " 'Creedence Clearwater Revival': 285,\n",
       " 'Cat Power': 286,\n",
       " 'B.o.B': 287,\n",
       " 'Carrie Underwood': 288,\n",
       " 'ABBA': 289,\n",
       " 'Lifehouse': 290,\n",
       " 'Sonic Youth': 291,\n",
       " 'Ramones': 292,\n",
       " 'The Fratellis': 293,\n",
       " 'Jay-Z': 294,\n",
       " 'Metric': 295,\n",
       " 'Jimi Hendrix': 296,\n",
       " 'Avenged Sevenfold': 297,\n",
       " 'Dave Gahan': 298,\n",
       " 'Norah Jones': 299,\n",
       " 'Mötley Crüe': 300,\n",
       " 'Breaking Benjamin': 301,\n",
       " 'Adele': 302,\n",
       " 'Rage Against the Machine': 303,\n",
       " 'Lacuna Coil': 304,\n",
       " 'Leighton Meester': 305,\n",
       " 'M.I.A.': 306,\n",
       " 'BoA': 307,\n",
       " 'Feist': 308,\n",
       " 'KISS': 309,\n",
       " 'Aerosmith': 310,\n",
       " 'Van Halen': 311,\n",
       " 'Morrissey': 312,\n",
       " 'Robyn': 313,\n",
       " 'Regina Spektor': 314,\n",
       " 'Spice Girls': 315,\n",
       " 'Cansei de Ser Sexy': 316}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_to_index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "667c98df",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: 'Duran Duran',\n",
       " 1: 'Air',\n",
       " 2: 'Kylie Minogue',\n",
       " 3: 'Daft Punk',\n",
       " 4: 'Goldfrapp',\n",
       " 5: 'New Order',\n",
       " 6: 'Röyksopp',\n",
       " 7: 'Coldplay',\n",
       " 8: 'Madonna',\n",
       " 9: 'Moby',\n",
       " 10: 'Dido',\n",
       " 11: 'Depeche Mode',\n",
       " 12: 'Portishead',\n",
       " 13: 'Gorillaz',\n",
       " 14: 'Lady Gaga',\n",
       " 15: 'Duffy',\n",
       " 16: 'Porcupine Tree',\n",
       " 17: 'Radiohead',\n",
       " 18: 'Robbie Williams',\n",
       " 19: 'Michael Jackson',\n",
       " 20: 'The Cure',\n",
       " 21: 'Enrique Iglesias',\n",
       " 22: 'Pink Floyd',\n",
       " 23: 'The Cranberries',\n",
       " 24: 'Garbage',\n",
       " 25: 'Placebo',\n",
       " 26: 'Scorpions',\n",
       " 27: 'Keane',\n",
       " 28: 'James Blunt',\n",
       " 29: 'a-ha',\n",
       " 30: 'Opeth',\n",
       " 31: 'Muse',\n",
       " 32: 'OneRepublic',\n",
       " 33: 'Tears for Fears',\n",
       " 34: 'Beirut',\n",
       " 35: 'System of a Down',\n",
       " 36: 'Arcade Fire',\n",
       " 37: 'Blur',\n",
       " 38: 'Damien Rice',\n",
       " 39: 'Beck',\n",
       " 40: 'Arctic Monkeys',\n",
       " 41: 'My Chemical Romance',\n",
       " 42: 'Bloc Party',\n",
       " 43: 'Bob Dylan',\n",
       " 44: 'Death Cab for Cutie',\n",
       " 45: 'Red Hot Chili Peppers',\n",
       " 46: 'Travis',\n",
       " 47: 'Modest Mouse',\n",
       " 48: 'Interpol',\n",
       " 49: 'Queens of the Stone Age',\n",
       " 50: 'The Beatles',\n",
       " 51: 'Kings of Leon',\n",
       " 52: 'The Killers',\n",
       " 53: 'Green Day',\n",
       " 54: 'Nine Inch Nails',\n",
       " 55: 'Nirvana',\n",
       " 56: 'Massive Attack',\n",
       " 57: 'Bob Marley',\n",
       " 58: 'Mariah Carey',\n",
       " 59: 'Céline Dion',\n",
       " 60: 'Janet Jackson',\n",
       " 61: 'Rihanna',\n",
       " 62: 'Britney Spears',\n",
       " 63: 'Jordin Sparks',\n",
       " 64: 'Kelly Clarkson',\n",
       " 65: 'Christina Aguilera',\n",
       " 66: 'Ashlee Simpson',\n",
       " 67: 'Leona Lewis',\n",
       " 68: 'Beyoncé',\n",
       " 69: 'Sugababes',\n",
       " 70: 'Lily Allen',\n",
       " 71: 'Jennifer Lopez',\n",
       " 72: 'Katy Perry',\n",
       " 73: 'Alicia Keys',\n",
       " 74: 'P!nk',\n",
       " 75: 'David Archuleta',\n",
       " 76: 'Black Eyed Peas',\n",
       " 77: 'Nelly Furtado',\n",
       " 78: 'Natasha Bedingfield',\n",
       " 79: 'Ciara',\n",
       " 80: 'Alanis Morissette',\n",
       " 81: 'Keri Hilson',\n",
       " 82: 'Hilary Duff',\n",
       " 83: 'Fergie',\n",
       " 84: 'Jonas Brothers',\n",
       " 85: 'The Saturdays',\n",
       " 86: 'Cobra Starship',\n",
       " 87: 'Ashley Tisdale',\n",
       " 88: 'JoJo',\n",
       " 89: 'Chris Brown',\n",
       " 90: 'David Guetta',\n",
       " 91: 'Justin Timberlake',\n",
       " 92: 'T.I.',\n",
       " 93: 'Kanye West',\n",
       " 94: 'Kelly Rowland',\n",
       " 95: 'Avril Lavigne',\n",
       " 96: 'Cher',\n",
       " 97: 'Colbie Caillat',\n",
       " 98: 'Taylor Swift',\n",
       " 99: 'The Pussycat Dolls',\n",
       " 100: 'Cheryl Cole',\n",
       " 101: 'Jason Mraz',\n",
       " 102: 'Jack Johnson',\n",
       " 103: 'Linkin Park',\n",
       " 104: 'Evanescence',\n",
       " 105: 'Cascada',\n",
       " 106: 'The All-American Rejects',\n",
       " 107: 'blink-182',\n",
       " 108: 'The National',\n",
       " 109: 'Sigur Rós',\n",
       " 110: 'Bat for Lashes',\n",
       " 111: 'The Strokes',\n",
       " 112: 'Yeah Yeah Yeahs',\n",
       " 113: 'The Libertines',\n",
       " 114: 'The Smiths',\n",
       " 115: 'Kate Nash',\n",
       " 116: 'Klaxons',\n",
       " 117: 'The Smashing Pumpkins',\n",
       " 118: 'Los Hermanos',\n",
       " 119: 'Animal Collective',\n",
       " 120: 'Joy Division',\n",
       " 121: 'Backstreet Boys',\n",
       " 122: 'Jesse McCartney',\n",
       " 123: 'Justin Bieber',\n",
       " 124: 'Miley Cyrus',\n",
       " 125: '3OH!3',\n",
       " 126: 'Jessica Simpson',\n",
       " 127: 'Ke$ha',\n",
       " 128: 'Usher',\n",
       " 129: '3 Doors Down',\n",
       " 130: 'Eminem',\n",
       " 131: 'Simple Plan',\n",
       " 132: 'Ne-Yo',\n",
       " 133: '30 Seconds to Mars',\n",
       " 134: 'Three Days Grace',\n",
       " 135: 'Limp Bizkit',\n",
       " 136: 'Papa Roach',\n",
       " 137: 'Paramore',\n",
       " 138: 'Flyleaf',\n",
       " 139: 'Bullet for My Valentine',\n",
       " 140: 'In Flames',\n",
       " 141: 'HIM',\n",
       " 142: 'U2',\n",
       " 143: 'Deftones',\n",
       " 144: 'Korn',\n",
       " 145: 'Within Temptation',\n",
       " 146: 'Lindsay Lohan',\n",
       " 147: 'Gwen Stefani',\n",
       " 148: 'La Roux',\n",
       " 149: 'Pixie Lott',\n",
       " 150: 'Taio Cruz',\n",
       " 151: 'Little Boots',\n",
       " 152: 'Oasis',\n",
       " 153: 'No Doubt',\n",
       " 154: 'Sophie Ellis-Bextor',\n",
       " 155: 'Good Charlotte',\n",
       " 156: 'The Used',\n",
       " 157: 'Maroon 5',\n",
       " 158: 'Fall Out Boy',\n",
       " 159: 'Pitty',\n",
       " 160: 'Nicole Scherzinger',\n",
       " 161: 'Adam Lambert',\n",
       " 162: 'The Ting Tings',\n",
       " 163: 'Ellie Goulding',\n",
       " 164: 'The Kinks',\n",
       " 165: 'The Who',\n",
       " 166: 'David Bowie',\n",
       " 167: 'Aphex Twin',\n",
       " 168: 'Kings of Convenience',\n",
       " 169: 'Pearl Jam',\n",
       " 170: 'Elliott Smith',\n",
       " 171: 'Belle and Sebastian',\n",
       " 172: 'Sufjan Stevens',\n",
       " 173: 'Explosions in the Sky',\n",
       " 174: 'RBD',\n",
       " 175: 'Glee Cast',\n",
       " 176: 'The Veronicas',\n",
       " 177: 'Demi Lovato',\n",
       " 178: 'John Mayer',\n",
       " 179: 'Selena Gomez & the Scene',\n",
       " 180: 'All Time Low',\n",
       " 181: 'Florence + the Machine',\n",
       " 182: 'Marina & the Diamonds',\n",
       " 183: 'Owl City',\n",
       " 184: 'Sia',\n",
       " 185: 'Shakira',\n",
       " 186: 'The xx',\n",
       " 187: 'The Pretty Reckless',\n",
       " 188: 'AC/DC',\n",
       " 189: 'Metallica',\n",
       " 190: 'The White Stripes',\n",
       " 191: 'Legião Urbana',\n",
       " 192: 'R.E.M.',\n",
       " 193: 'Kaiser Chiefs',\n",
       " 194: 'Johnny Cash',\n",
       " 195: 'Ozzy Osbourne',\n",
       " 196: 'Apocalyptica',\n",
       " 197: 'Eric Clapton',\n",
       " 198: 'Alice Cooper',\n",
       " 199: 'John Lennon',\n",
       " 200: 'The Rolling Stones',\n",
       " 201: 'Boards of Canada',\n",
       " 202: 'Crystal Castles',\n",
       " 203: 'Bring Me The Horizon',\n",
       " 204: 'Belinda',\n",
       " 205: 'Anahí',\n",
       " 206: 'Rise Against',\n",
       " 207: 'A Day to Remember',\n",
       " 208: 'Slayer',\n",
       " 209: 'Pantera',\n",
       " 210: 'Marilyn Manson',\n",
       " 211: 'Manic Street Preachers',\n",
       " 212: 'Alice in Chains',\n",
       " 213: 'The Clash',\n",
       " 214: 'Pixies',\n",
       " 215: 'The Velvet Underground',\n",
       " 216: 'The Doors',\n",
       " 217: 'Cyndi Lauper',\n",
       " 218: 'Tegan and Sara',\n",
       " 219: 'Amy Winehouse',\n",
       " 220: 'Girls Aloud',\n",
       " 221: 'Timbaland',\n",
       " 222: 'Vanessa Hudgens',\n",
       " 223: \"Destiny's Child\",\n",
       " 224: 'Iron Maiden',\n",
       " 225: 'Megadeth',\n",
       " 226: 'Dream Theater',\n",
       " 227: 'Children of Bodom',\n",
       " 228: 'Nightwish',\n",
       " 229: 'Bon Jovi',\n",
       " 230: 'Queen',\n",
       " 231: 'Tori Amos',\n",
       " 232: 'The Mars Volta',\n",
       " 233: 'Nickelback',\n",
       " 234: 'Kasabian',\n",
       " 235: 't.A.T.u.',\n",
       " 236: 'Disturbed',\n",
       " 237: 'Foo Fighters',\n",
       " 238: 'Pet Shop Boys',\n",
       " 239: 'Erasure',\n",
       " 240: 'Jessie J',\n",
       " 241: 'Kerli',\n",
       " 242: 'Nicki Minaj',\n",
       " 243: 'Bruno Mars',\n",
       " 244: 'Boys Like Girls',\n",
       " 245: 'Slipknot',\n",
       " 246: 'Fresno',\n",
       " 247: 'McFly',\n",
       " 248: 'The Kooks',\n",
       " 249: 'Ladytron',\n",
       " 250: 'IAMX',\n",
       " 251: 'Franz Ferdinand',\n",
       " 252: 'Björk',\n",
       " 253: 'The Prodigy',\n",
       " 254: 'Rammstein',\n",
       " 255: 'Phoenix',\n",
       " 256: 'Yann Tiersen',\n",
       " 257: 'Incubus',\n",
       " 258: 'A Perfect Circle',\n",
       " 259: 'Faith No More',\n",
       " 260: 'The Police',\n",
       " 261: 'Tool',\n",
       " 262: 'Escape The Fate',\n",
       " 263: 'Sum 41',\n",
       " 264: 'Misfits',\n",
       " 265: 'Weezer',\n",
       " 266: 'The Beach Boys',\n",
       " 267: 'Mika',\n",
       " 268: 'Elvis Presley',\n",
       " 269: 'Panic! At the Disco',\n",
       " 270: \"Guns N' Roses\",\n",
       " 271: 'Judas Priest',\n",
       " 272: 'Motörhead',\n",
       " 273: 'Black Sabbath',\n",
       " 274: 'Deep Purple',\n",
       " 275: 'Snow Patrol',\n",
       " 276: 'White Lies',\n",
       " 277: 'The Fray',\n",
       " 278: 'Hurts',\n",
       " 279: 'Vampire Weekend',\n",
       " 280: 'Justice',\n",
       " 281: 'MGMT',\n",
       " 282: 'The Offspring',\n",
       " 283: 'Led Zeppelin',\n",
       " 284: 'Paul McCartney',\n",
       " 285: 'Creedence Clearwater Revival',\n",
       " 286: 'Cat Power',\n",
       " 287: 'B.o.B',\n",
       " 288: 'Carrie Underwood',\n",
       " 289: 'ABBA',\n",
       " 290: 'Lifehouse',\n",
       " 291: 'Sonic Youth',\n",
       " 292: 'Ramones',\n",
       " 293: 'The Fratellis',\n",
       " 294: 'Jay-Z',\n",
       " 295: 'Metric',\n",
       " 296: 'Jimi Hendrix',\n",
       " 297: 'Avenged Sevenfold',\n",
       " 298: 'Dave Gahan',\n",
       " 299: 'Norah Jones',\n",
       " 300: 'Mötley Crüe',\n",
       " 301: 'Breaking Benjamin',\n",
       " 302: 'Adele',\n",
       " 303: 'Rage Against the Machine',\n",
       " 304: 'Lacuna Coil',\n",
       " 305: 'Leighton Meester',\n",
       " 306: 'M.I.A.',\n",
       " 307: 'BoA',\n",
       " 308: 'Feist',\n",
       " 309: 'KISS',\n",
       " 310: 'Aerosmith',\n",
       " 311: 'Van Halen',\n",
       " 312: 'Morrissey',\n",
       " 313: 'Robyn',\n",
       " 314: 'Regina Spektor',\n",
       " 315: 'Spice Girls',\n",
       " 316: 'Cansei de Ser Sexy'}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "index_to_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "d02af329",
   "metadata": {},
   "outputs": [],
   "source": [
    "#对用户的处理\n",
    "user_id_to_index ={}\n",
    "index_to_user_id = {}\n",
    "for i,user_id in enumerate(data['userID'].unique()): #遍历data中的userID列\n",
    "    user_id_to_index[user_id] = i  #将userID映射到数字\n",
    "    index_to_user_id[i] = user_id #将数字映射到userID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "deac818e",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{2: 0,\n",
       " 4: 1,\n",
       " 27: 2,\n",
       " 28: 3,\n",
       " 62: 4,\n",
       " 63: 5,\n",
       " 66: 6,\n",
       " 73: 7,\n",
       " 96: 8,\n",
       " 117: 9,\n",
       " 128: 10,\n",
       " 141: 11,\n",
       " 142: 12,\n",
       " 176: 13,\n",
       " 185: 14,\n",
       " 187: 15,\n",
       " 191: 16,\n",
       " 196: 17,\n",
       " 211: 18,\n",
       " 224: 19,\n",
       " 263: 20,\n",
       " 264: 21,\n",
       " 266: 22,\n",
       " 269: 23,\n",
       " 275: 24,\n",
       " 290: 25,\n",
       " 306: 26,\n",
       " 338: 27,\n",
       " 359: 28,\n",
       " 397: 29,\n",
       " 423: 30,\n",
       " 428: 31,\n",
       " 430: 32,\n",
       " 436: 33,\n",
       " 446: 34,\n",
       " 452: 35,\n",
       " 453: 36,\n",
       " 480: 37,\n",
       " 488: 38,\n",
       " 499: 39,\n",
       " 515: 40,\n",
       " 539: 41,\n",
       " 540: 42,\n",
       " 568: 43,\n",
       " 576: 44,\n",
       " 577: 45,\n",
       " 592: 46,\n",
       " 596: 47,\n",
       " 643: 48,\n",
       " 656: 49,\n",
       " 658: 50,\n",
       " 683: 51,\n",
       " 686: 52,\n",
       " 694: 53,\n",
       " 699: 54,\n",
       " 714: 55,\n",
       " 761: 56,\n",
       " 788: 57,\n",
       " 791: 58,\n",
       " 832: 59,\n",
       " 864: 60,\n",
       " 959: 61,\n",
       " 1003: 62,\n",
       " 1010: 63,\n",
       " 1029: 64,\n",
       " 1038: 65,\n",
       " 1074: 66,\n",
       " 1089: 67,\n",
       " 1149: 68,\n",
       " 1163: 69,\n",
       " 1192: 70,\n",
       " 1200: 71,\n",
       " 1202: 72,\n",
       " 1209: 73,\n",
       " 1210: 74,\n",
       " 1229: 75,\n",
       " 1232: 76,\n",
       " 1235: 77,\n",
       " 1249: 78,\n",
       " 1327: 79,\n",
       " 1336: 80,\n",
       " 1343: 81,\n",
       " 1384: 82,\n",
       " 1427: 83,\n",
       " 1454: 84,\n",
       " 1456: 85,\n",
       " 1498: 86,\n",
       " 1505: 87,\n",
       " 1514: 88,\n",
       " 1541: 89,\n",
       " 1585: 90,\n",
       " 1643: 91,\n",
       " 1722: 92,\n",
       " 1724: 93,\n",
       " 1775: 94,\n",
       " 1818: 95,\n",
       " 1845: 96,\n",
       " 1853: 97,\n",
       " 1866: 98,\n",
       " 1881: 99,\n",
       " 1900: 100,\n",
       " 1905: 101,\n",
       " 1956: 102,\n",
       " 1958: 103,\n",
       " 2014: 104,\n",
       " 2025: 105,\n",
       " 2055: 106,\n",
       " 2075: 107,\n",
       " 5: 108,\n",
       " 34: 109,\n",
       " 43: 110,\n",
       " 103: 111,\n",
       " 184: 112,\n",
       " 194: 113,\n",
       " 243: 114,\n",
       " 315: 115,\n",
       " 358: 116,\n",
       " 366: 117,\n",
       " 398: 118,\n",
       " 407: 119,\n",
       " 426: 120,\n",
       " 434: 121,\n",
       " 440: 122,\n",
       " 460: 123,\n",
       " 490: 124,\n",
       " 606: 125,\n",
       " 628: 126,\n",
       " 635: 127,\n",
       " 647: 128,\n",
       " 697: 129,\n",
       " 718: 130,\n",
       " 756: 131,\n",
       " 765: 132,\n",
       " 802: 133,\n",
       " 813: 134,\n",
       " 837: 135,\n",
       " 893: 136,\n",
       " 896: 137,\n",
       " 925: 138,\n",
       " 928: 139,\n",
       " 968: 140,\n",
       " 990: 141,\n",
       " 997: 142,\n",
       " 1006: 143,\n",
       " 1049: 144,\n",
       " 1050: 145,\n",
       " 1075: 146,\n",
       " 1098: 147,\n",
       " 1102: 148,\n",
       " 1130: 149,\n",
       " 1133: 150,\n",
       " 1173: 151,\n",
       " 1225: 152,\n",
       " 1234: 153,\n",
       " 1239: 154,\n",
       " 1265: 155,\n",
       " 1383: 156,\n",
       " 1491: 157,\n",
       " 1496: 158,\n",
       " 1587: 159,\n",
       " 1674: 160,\n",
       " 1691: 161,\n",
       " 1747: 162,\n",
       " 1785: 163,\n",
       " 1798: 164,\n",
       " 1801: 165,\n",
       " 1832: 166,\n",
       " 1836: 167,\n",
       " 1885: 168,\n",
       " 1926: 169,\n",
       " 1992: 170,\n",
       " 2032: 171,\n",
       " 2047: 172,\n",
       " 2080: 173,\n",
       " 7: 174,\n",
       " 13: 175,\n",
       " 21: 176,\n",
       " 24: 177,\n",
       " 25: 178,\n",
       " 29: 179,\n",
       " 31: 180,\n",
       " 48: 181,\n",
       " 53: 182,\n",
       " 54: 183,\n",
       " 72: 184,\n",
       " 75: 185,\n",
       " 95: 186,\n",
       " 98: 187,\n",
       " 110: 188,\n",
       " 126: 189,\n",
       " 129: 190,\n",
       " 130: 191,\n",
       " 132: 192,\n",
       " 134: 193,\n",
       " 135: 194,\n",
       " 136: 195,\n",
       " 137: 196,\n",
       " 144: 197,\n",
       " 147: 198,\n",
       " 209: 199,\n",
       " 214: 200,\n",
       " 227: 201,\n",
       " 230: 202,\n",
       " 232: 203,\n",
       " 233: 204,\n",
       " 240: 205,\n",
       " 252: 206,\n",
       " 253: 207,\n",
       " 256: 208,\n",
       " 271: 209,\n",
       " 278: 210,\n",
       " 299: 211,\n",
       " 302: 212,\n",
       " 305: 213,\n",
       " 310: 214,\n",
       " 327: 215,\n",
       " 329: 216,\n",
       " 332: 217,\n",
       " 333: 218,\n",
       " 335: 219,\n",
       " 339: 220,\n",
       " 340: 221,\n",
       " 346: 222,\n",
       " 350: 223,\n",
       " 357: 224,\n",
       " 361: 225,\n",
       " 390: 226,\n",
       " 400: 227,\n",
       " 405: 228,\n",
       " 413: 229,\n",
       " 414: 230,\n",
       " 415: 231,\n",
       " 417: 232,\n",
       " 420: 233,\n",
       " 421: 234,\n",
       " 425: 235,\n",
       " 458: 236,\n",
       " 470: 237,\n",
       " 472: 238,\n",
       " 477: 239,\n",
       " 479: 240,\n",
       " 481: 241,\n",
       " 494: 242,\n",
       " 495: 243,\n",
       " 497: 244,\n",
       " 498: 245,\n",
       " 501: 246,\n",
       " 502: 247,\n",
       " 503: 248,\n",
       " 518: 249,\n",
       " 520: 250,\n",
       " 527: 251,\n",
       " 531: 252,\n",
       " 535: 253,\n",
       " 538: 254,\n",
       " 569: 255,\n",
       " 571: 256,\n",
       " 572: 257,\n",
       " 581: 258,\n",
       " 584: 259,\n",
       " 598: 260,\n",
       " 604: 261,\n",
       " 609: 262,\n",
       " 612: 263,\n",
       " 617: 264,\n",
       " 621: 265,\n",
       " 632: 266,\n",
       " 636: 267,\n",
       " 638: 268,\n",
       " 651: 269,\n",
       " 659: 270,\n",
       " 670: 271,\n",
       " 674: 272,\n",
       " 675: 273,\n",
       " 679: 274,\n",
       " 680: 275,\n",
       " 682: 276,\n",
       " 688: 277,\n",
       " 689: 278,\n",
       " 690: 279,\n",
       " 703: 280,\n",
       " 713: 281,\n",
       " 717: 282,\n",
       " 722: 283,\n",
       " 723: 284,\n",
       " 730: 285,\n",
       " 732: 286,\n",
       " 735: 287,\n",
       " 749: 288,\n",
       " 777: 289,\n",
       " 778: 290,\n",
       " 793: 291,\n",
       " 795: 292,\n",
       " 808: 293,\n",
       " 816: 294,\n",
       " 836: 295,\n",
       " 850: 296,\n",
       " 851: 297,\n",
       " 852: 298,\n",
       " 853: 299,\n",
       " 859: 300,\n",
       " 873: 301,\n",
       " 885: 302,\n",
       " 898: 303,\n",
       " 905: 304,\n",
       " 909: 305,\n",
       " 910: 306,\n",
       " 954: 307,\n",
       " 955: 308,\n",
       " 963: 309,\n",
       " 965: 310,\n",
       " 966: 311,\n",
       " 985: 312,\n",
       " 1002: 313,\n",
       " 1017: 314,\n",
       " 1023: 315,\n",
       " 1027: 316,\n",
       " 1033: 317,\n",
       " 1046: 318,\n",
       " 1053: 319,\n",
       " 1057: 320,\n",
       " 1069: 321,\n",
       " 1071: 322,\n",
       " 1092: 323,\n",
       " 1104: 324,\n",
       " 1106: 325,\n",
       " 1109: 326,\n",
       " 1120: 327,\n",
       " 1132: 328,\n",
       " 1135: 329,\n",
       " 1136: 330,\n",
       " 1137: 331,\n",
       " 1171: 332,\n",
       " 1184: 333,\n",
       " 1185: 334,\n",
       " 1186: 335,\n",
       " 1188: 336,\n",
       " 1189: 337,\n",
       " 1197: 338,\n",
       " 1198: 339,\n",
       " 1226: 340,\n",
       " 1233: 341,\n",
       " 1246: 342,\n",
       " 1247: 343,\n",
       " 1253: 344,\n",
       " 1255: 345,\n",
       " 1263: 346,\n",
       " 1272: 347,\n",
       " 1280: 348,\n",
       " 1291: 349,\n",
       " 1299: 350,\n",
       " 1300: 351,\n",
       " 1301: 352,\n",
       " 1305: 353,\n",
       " 1308: 354,\n",
       " 1356: 355,\n",
       " 1365: 356,\n",
       " 1379: 357,\n",
       " 1389: 358,\n",
       " 1399: 359,\n",
       " 1413: 360,\n",
       " 1431: 361,\n",
       " 1435: 362,\n",
       " 1445: 363,\n",
       " 1447: 364,\n",
       " 1462: 365,\n",
       " 1466: 366,\n",
       " 1471: 367,\n",
       " 1478: 368,\n",
       " 1485: 369,\n",
       " 1489: 370,\n",
       " 1517: 371,\n",
       " 1528: 372,\n",
       " 1532: 373,\n",
       " 1533: 374,\n",
       " 1540: 375,\n",
       " 1555: 376,\n",
       " 1563: 377,\n",
       " 1564: 378,\n",
       " 1572: 379,\n",
       " 1590: 380,\n",
       " 1600: 381,\n",
       " 1605: 382,\n",
       " 1606: 383,\n",
       " 1607: 384,\n",
       " 1608: 385,\n",
       " 1616: 386,\n",
       " 1621: 387,\n",
       " 1628: 388,\n",
       " 1633: 389,\n",
       " 1648: 390,\n",
       " 1659: 391,\n",
       " 1663: 392,\n",
       " 1666: 393,\n",
       " 1690: 394,\n",
       " 1715: 395,\n",
       " 1717: 396,\n",
       " 1726: 397,\n",
       " 1730: 398,\n",
       " 1736: 399,\n",
       " 1741: 400,\n",
       " 1742: 401,\n",
       " 1753: 402,\n",
       " 1757: 403,\n",
       " 1765: 404,\n",
       " 1766: 405,\n",
       " 1771: 406,\n",
       " 1780: 407,\n",
       " 1790: 408,\n",
       " 1791: 409,\n",
       " 1795: 410,\n",
       " 1808: 411,\n",
       " 1813: 412,\n",
       " 1820: 413,\n",
       " 1821: 414,\n",
       " 1828: 415,\n",
       " 1829: 416,\n",
       " 1838: 417,\n",
       " 1850: 418,\n",
       " 1856: 419,\n",
       " 1869: 420,\n",
       " 1873: 421,\n",
       " 1880: 422,\n",
       " 1895: 423,\n",
       " 1903: 424,\n",
       " 1908: 425,\n",
       " 1909: 426,\n",
       " 1910: 427,\n",
       " 1915: 428,\n",
       " 1928: 429,\n",
       " 1946: 430,\n",
       " 1959: 431,\n",
       " 1965: 432,\n",
       " 1973: 433,\n",
       " 1979: 434,\n",
       " 1983: 435,\n",
       " 1988: 436,\n",
       " 2018: 437,\n",
       " 2021: 438,\n",
       " 2027: 439,\n",
       " 2031: 440,\n",
       " 2033: 441,\n",
       " 2040: 442,\n",
       " 2056: 443,\n",
       " 2058: 444,\n",
       " 2068: 445,\n",
       " 2087: 446,\n",
       " 2088: 447,\n",
       " 17: 448,\n",
       " 18: 449,\n",
       " 20: 450,\n",
       " 33: 451,\n",
       " 50: 452,\n",
       " 59: 453,\n",
       " 101: 454,\n",
       " 123: 455,\n",
       " 125: 456,\n",
       " 161: 457,\n",
       " 180: 458,\n",
       " 193: 459,\n",
       " 216: 460,\n",
       " 234: 461,\n",
       " 250: 462,\n",
       " 280: 463,\n",
       " 303: 464,\n",
       " 345: 465,\n",
       " 383: 466,\n",
       " 385: 467,\n",
       " 386: 468,\n",
       " 393: 469,\n",
       " 396: 470,\n",
       " 418: 471,\n",
       " 465: 472,\n",
       " 482: 473,\n",
       " 496: 474,\n",
       " 556: 475,\n",
       " 560: 476,\n",
       " 605: 477,\n",
       " 639: 478,\n",
       " 665: 479,\n",
       " 672: 480,\n",
       " 705: 481,\n",
       " 741: 482,\n",
       " 746: 483,\n",
       " 780: 484,\n",
       " 846: 485,\n",
       " 863: 486,\n",
       " 889: 487,\n",
       " 914: 488,\n",
       " 943: 489,\n",
       " 960: 490,\n",
       " 982: 491,\n",
       " 1001: 492,\n",
       " 1012: 493,\n",
       " 1040: 494,\n",
       " 1052: 495,\n",
       " 1062: 496,\n",
       " 1084: 497,\n",
       " 1099: 498,\n",
       " 1107: 499,\n",
       " 1147: 500,\n",
       " 1155: 501,\n",
       " 1187: 502,\n",
       " 1190: 503,\n",
       " 1191: 504,\n",
       " 1194: 505,\n",
       " 1212: 506,\n",
       " 1273: 507,\n",
       " 1282: 508,\n",
       " 1295: 509,\n",
       " 1321: 510,\n",
       " 1350: 511,\n",
       " 1395: 512,\n",
       " 1422: 513,\n",
       " 1441: 514,\n",
       " 1450: 515,\n",
       " 1453: 516,\n",
       " 1469: 517,\n",
       " 1470: 518,\n",
       " 1472: 519,\n",
       " 1474: 520,\n",
       " 1480: 521,\n",
       " 1503: 522,\n",
       " 1504: 523,\n",
       " 1508: 524,\n",
       " 1522: 525,\n",
       " 1539: 526,\n",
       " 1542: 527,\n",
       " 1562: 528,\n",
       " 1565: 529,\n",
       " 1579: 530,\n",
       " 1591: 531,\n",
       " 1597: 532,\n",
       " 1620: 533,\n",
       " 1642: 534,\n",
       " 1656: 535,\n",
       " 1658: 536,\n",
       " 1685: 537,\n",
       " 1692: 538,\n",
       " 1706: 539,\n",
       " 1740: 540,\n",
       " 1752: 541,\n",
       " 1755: 542,\n",
       " 1760: 543,\n",
       " 1772: 544,\n",
       " 1783: 545,\n",
       " 1793: 546,\n",
       " 1835: 547,\n",
       " 1842: 548,\n",
       " 1877: 549,\n",
       " 1920: 550,\n",
       " 1933: 551,\n",
       " 1942: 552,\n",
       " 1974: 553,\n",
       " 1993: 554,\n",
       " 1996: 555,\n",
       " 2008: 556,\n",
       " 2017: 557,\n",
       " 2029: 558,\n",
       " 2038: 559,\n",
       " 2057: 560,\n",
       " 2091: 561,\n",
       " 2097: 562,\n",
       " 311: 563,\n",
       " 320: 564,\n",
       " 352: 565,\n",
       " 370: 566,\n",
       " 375: 567,\n",
       " 441: 568,\n",
       " 543: 569,\n",
       " 565: 570,\n",
       " 611: 571,\n",
       " 691: 572,\n",
       " 806: 573,\n",
       " 919: 574,\n",
       " 922: 575,\n",
       " 994: 576,\n",
       " 1035: 577,\n",
       " 1065: 578,\n",
       " 1097: 579,\n",
       " 1219: 580,\n",
       " 1220: 581,\n",
       " 1261: 582,\n",
       " 1275: 583,\n",
       " 1520: 584,\n",
       " 1534: 585,\n",
       " 1636: 586,\n",
       " 1637: 587,\n",
       " 1732: 588,\n",
       " 1746: 589,\n",
       " 2016: 590,\n",
       " 2028: 591,\n",
       " 2059: 592,\n",
       " 94: 593,\n",
       " 183: 594,\n",
       " 455: 595,\n",
       " 530: 596,\n",
       " 566: 597,\n",
       " 625: 598,\n",
       " 710: 599,\n",
       " 728: 600,\n",
       " 799: 601,\n",
       " 855: 602,\n",
       " 940: 603,\n",
       " 1036: 604,\n",
       " 1067: 605,\n",
       " 1148: 606,\n",
       " 1152: 607,\n",
       " 1153: 608,\n",
       " 1211: 609,\n",
       " 1223: 610,\n",
       " 1244: 611,\n",
       " 1518: 612,\n",
       " 1545: 613,\n",
       " 1595: 614,\n",
       " 1689: 615,\n",
       " 1728: 616,\n",
       " 1855: 617,\n",
       " 1950: 618,\n",
       " 1962: 619,\n",
       " 1964: 620,\n",
       " 1991: 621,\n",
       " 1994: 622,\n",
       " 159: 623,\n",
       " 336: 624,\n",
       " 342: 625,\n",
       " 513: 626,\n",
       " 1103: 627,\n",
       " 1164: 628,\n",
       " 1313: 629,\n",
       " 1459: 630,\n",
       " 1464: 631,\n",
       " 1624: 632,\n",
       " 1630: 633,\n",
       " 1669: 634,\n",
       " 1817: 635,\n",
       " 1947: 636,\n",
       " 2003: 637,\n",
       " 2006: 638,\n",
       " 2030: 639,\n",
       " 42: 640,\n",
       " 55: 641,\n",
       " 61: 642,\n",
       " 68: 643,\n",
       " 99: 644,\n",
       " 100: 645,\n",
       " 120: 646,\n",
       " 124: 647,\n",
       " 140: 648,\n",
       " 151: 649,\n",
       " 156: 650,\n",
       " 171: 651,\n",
       " 174: 652,\n",
       " 200: 653,\n",
       " 218: 654,\n",
       " 236: 655,\n",
       " 244: 656,\n",
       " 285: 657,\n",
       " 288: 658,\n",
       " 289: 659,\n",
       " 304: 660,\n",
       " 326: 661,\n",
       " 328: 662,\n",
       " 347: 663,\n",
       " 355: 664,\n",
       " 362: 665,\n",
       " 392: 666,\n",
       " 427: 667,\n",
       " 431: 668,\n",
       " 456: 669,\n",
       " 461: 670,\n",
       " 464: 671,\n",
       " 468: 672,\n",
       " 475: 673,\n",
       " 511: 674,\n",
       " 544: 675,\n",
       " 551: 676,\n",
       " 567: 677,\n",
       " 580: 678,\n",
       " 585: 679,\n",
       " 587: 680,\n",
       " 601: 681,\n",
       " 629: 682,\n",
       " 631: 683,\n",
       " 633: 684,\n",
       " 634: 685,\n",
       " 644: 686,\n",
       " 654: 687,\n",
       " 662: 688,\n",
       " 668: 689,\n",
       " 673: 690,\n",
       " 678: 691,\n",
       " 695: 692,\n",
       " 716: 693,\n",
       " 729: 694,\n",
       " 733: 695,\n",
       " 758: 696,\n",
       " 762: 697,\n",
       " 763: 698,\n",
       " 767: 699,\n",
       " 771: 700,\n",
       " 784: 701,\n",
       " 794: 702,\n",
       " 805: 703,\n",
       " 818: 704,\n",
       " 821: 705,\n",
       " 824: 706,\n",
       " 830: 707,\n",
       " 841: 708,\n",
       " 849: 709,\n",
       " 871: 710,\n",
       " 881: 711,\n",
       " 900: 712,\n",
       " 904: 713,\n",
       " 913: 714,\n",
       " 917: 715,\n",
       " 929: 716,\n",
       " 941: 717,\n",
       " 967: 718,\n",
       " 971: 719,\n",
       " 975: 720,\n",
       " 991: 721,\n",
       " 999: 722,\n",
       " 1008: 723,\n",
       " 1015: 724,\n",
       " 1019: 725,\n",
       " 1022: 726,\n",
       " 1041: 727,\n",
       " 1042: 728,\n",
       " 1056: 729,\n",
       " 1070: 730,\n",
       " 1083: 731,\n",
       " 1093: 732,\n",
       " 1094: 733,\n",
       " 1111: 734,\n",
       " 1114: 735,\n",
       " 1134: 736,\n",
       " 1146: 737,\n",
       " 1151: 738,\n",
       " 1156: 739,\n",
       " 1159: 740,\n",
       " 1165: 741,\n",
       " 1179: 742,\n",
       " 1180: 743,\n",
       " 1215: 744,\n",
       " 1256: 745,\n",
       " 1264: 746,\n",
       " 1267: 747,\n",
       " 1270: 748,\n",
       " 1277: 749,\n",
       " 1278: 750,\n",
       " 1279: 751,\n",
       " 1292: 752,\n",
       " 1302: 753,\n",
       " 1319: 754,\n",
       " 1329: 755,\n",
       " 1333: 756,\n",
       " 1339: 757,\n",
       " 1372: 758,\n",
       " 1380: 759,\n",
       " 1381: 760,\n",
       " 1382: 761,\n",
       " 1387: 762,\n",
       " 1394: 763,\n",
       " 1407: 764,\n",
       " 1411: 765,\n",
       " 1414: 766,\n",
       " 1419: 767,\n",
       " 1424: 768,\n",
       " 1430: 769,\n",
       " 1433: 770,\n",
       " 1434: 771,\n",
       " 1437: 772,\n",
       " 1449: 773,\n",
       " 1486: 774,\n",
       " 1492: 775,\n",
       " 1494: 776,\n",
       " 1509: 777,\n",
       " 1519: 778,\n",
       " 1530: 779,\n",
       " 1538: 780,\n",
       " 1546: 781,\n",
       " 1583: 782,\n",
       " 1589: 783,\n",
       " 1594: 784,\n",
       " 1614: 785,\n",
       " 1629: 786,\n",
       " 1635: 787,\n",
       " 1647: 788,\n",
       " 1667: 789,\n",
       " 1676: 790,\n",
       " 1682: 791,\n",
       " 1684: 792,\n",
       " 1688: 793,\n",
       " 1705: 794,\n",
       " 1708: 795,\n",
       " 1712: 796,\n",
       " 1727: 797,\n",
       " 1778: 798,\n",
       " 1781: 799,\n",
       " 1784: 800,\n",
       " 1789: 801,\n",
       " 1797: 802,\n",
       " 1802: 803,\n",
       " 1814: 804,\n",
       " 1815: 805,\n",
       " 1823: 806,\n",
       " 1830: 807,\n",
       " 1831: 808,\n",
       " 1840: 809,\n",
       " 1844: 810,\n",
       " 1875: 811,\n",
       " 1888: 812,\n",
       " 1892: 813,\n",
       " 1898: 814,\n",
       " 1906: 815,\n",
       " 1911: 816,\n",
       " 1918: 817,\n",
       " 1922: 818,\n",
       " 1924: 819,\n",
       " 1931: 820,\n",
       " 1954: 821,\n",
       " 1955: 822,\n",
       " 1966: 823,\n",
       " 1969: 824,\n",
       " 1977: 825,\n",
       " 1980: 826,\n",
       " 1981: 827,\n",
       " 1982: 828,\n",
       " 1987: 829,\n",
       " 1997: 830,\n",
       " 1998: 831,\n",
       " 2010: 832,\n",
       " 2013: 833,\n",
       " 2019: 834,\n",
       " 2023: 835,\n",
       " 2024: 836,\n",
       " 2039: 837,\n",
       " 2042: 838,\n",
       " 2044: 839,\n",
       " 2062: 840,\n",
       " 2084: 841,\n",
       " 11: 842,\n",
       " 44: 843,\n",
       " 58: 844,\n",
       " 87: 845,\n",
       " 92: 846,\n",
       " 133: 847,\n",
       " 146: 848,\n",
       " 162: 849,\n",
       " 179: 850,\n",
       " 190: 851,\n",
       " 210: 852,\n",
       " 226: 853,\n",
       " 231: 854,\n",
       " 242: 855,\n",
       " 260: 856,\n",
       " 286: 857,\n",
       " 301: 858,\n",
       " 318: 859,\n",
       " 330: 860,\n",
       " 378: 861,\n",
       " 380: 862,\n",
       " 387: 863,\n",
       " 403: 864,\n",
       " 409: 865,\n",
       " 412: 866,\n",
       " 466: 867,\n",
       " 474: 868,\n",
       " 484: 869,\n",
       " 514: 870,\n",
       " 533: 871,\n",
       " 534: 872,\n",
       " 536: 873,\n",
       " 575: 874,\n",
       " 620: 875,\n",
       " 650: 876,\n",
       " 660: 877,\n",
       " 667: 878,\n",
       " 684: 879,\n",
       " 685: 880,\n",
       " 698: 881,\n",
       " 702: 882,\n",
       " 743: 883,\n",
       " 753: 884,\n",
       " 759: 885,\n",
       " 770: 886,\n",
       " 779: 887,\n",
       " 801: 888,\n",
       " 804: 889,\n",
       " 809: 890,\n",
       " 831: 891,\n",
       " 858: 892,\n",
       " 875: 893,\n",
       " 906: 894,\n",
       " 911: 895,\n",
       " 916: 896,\n",
       " 952: 897,\n",
       " 969: 898,\n",
       " 984: 899,\n",
       " 987: 900,\n",
       " 989: 901,\n",
       " 1026: 902,\n",
       " 1072: 903,\n",
       " 1080: 904,\n",
       " 1124: 905,\n",
       " 1139: 906,\n",
       " 1172: 907,\n",
       " 1222: 908,\n",
       " 1231: 909,\n",
       " 1237: 910,\n",
       " 1288: 911,\n",
       " 1298: 912,\n",
       " 1316: 913,\n",
       " 1318: 914,\n",
       " 1332: 915,\n",
       " 1337: 916,\n",
       " 1401: 917,\n",
       " 1423: 918,\n",
       " 1455: 919,\n",
       " 1458: 920,\n",
       " 1511: 921,\n",
       " 1516: 922,\n",
       " 1524: 923,\n",
       " 1544: 924,\n",
       " 1558: 925,\n",
       " 1560: 926,\n",
       " 1577: 927,\n",
       " 1578: 928,\n",
       " 1652: 929,\n",
       " 1653: 930,\n",
       " 1662: 931,\n",
       " 1678: 932,\n",
       " 1686: 933,\n",
       " 1762: 934,\n",
       " 1776: 935,\n",
       " 1811: 936,\n",
       " 1871: 937,\n",
       " 1894: 938,\n",
       " 1963: 939,\n",
       " 2000: 940,\n",
       " 2034: 941,\n",
       " 2037: 942,\n",
       " 2041: 943,\n",
       " 2053: 944,\n",
       " 2071: 945,\n",
       " 2076: 946,\n",
       " 307: 947,\n",
       " 325: 948,\n",
       " 559: 949,\n",
       " 773: 950,\n",
       " 786: 951,\n",
       " 868: 952,\n",
       " 1349: 953,\n",
       " 1352: 954,\n",
       " 1604: 955,\n",
       " 1641: 956,\n",
       " 2078: 957,\n",
       " 8: 958,\n",
       " 149: 959,\n",
       " 158: 960,\n",
       " 201: 961,\n",
       " 938: 962,\n",
       " 1294: 963,\n",
       " 1374: 964,\n",
       " 1570: 965,\n",
       " 1639: 966,\n",
       " 1677: 967,\n",
       " 1680: 968,\n",
       " 1833: 969,\n",
       " 1995: 970,\n",
       " 12: 971,\n",
       " 23: 972,\n",
       " 32: 973,\n",
       " 56: 974,\n",
       " 257: 975,\n",
       " 262: 976,\n",
       " 274: 977,\n",
       " 316: 978,\n",
       " 371: 979,\n",
       " 424: 980,\n",
       " 442: 981,\n",
       " 476: 982,\n",
       " 516: 983,\n",
       " 519: 984,\n",
       " 557: 985,\n",
       " 624: 986,\n",
       " 666: 987,\n",
       " 706: 988,\n",
       " 725: 989,\n",
       " 838: 990,\n",
       " 865: 991,\n",
       " 886: 992,\n",
       " 897: 993,\n",
       " 907: 994,\n",
       " 935: 995,\n",
       " 950: 996,\n",
       " 977: 997,\n",
       " 1021: 998,\n",
       " 1087: 999,\n",
       " ...}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_id_to_index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "91fb10aa",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: 2,\n",
       " 1: 4,\n",
       " 2: 27,\n",
       " 3: 28,\n",
       " 4: 62,\n",
       " 5: 63,\n",
       " 6: 66,\n",
       " 7: 73,\n",
       " 8: 96,\n",
       " 9: 117,\n",
       " 10: 128,\n",
       " 11: 141,\n",
       " 12: 142,\n",
       " 13: 176,\n",
       " 14: 185,\n",
       " 15: 187,\n",
       " 16: 191,\n",
       " 17: 196,\n",
       " 18: 211,\n",
       " 19: 224,\n",
       " 20: 263,\n",
       " 21: 264,\n",
       " 22: 266,\n",
       " 23: 269,\n",
       " 24: 275,\n",
       " 25: 290,\n",
       " 26: 306,\n",
       " 27: 338,\n",
       " 28: 359,\n",
       " 29: 397,\n",
       " 30: 423,\n",
       " 31: 428,\n",
       " 32: 430,\n",
       " 33: 436,\n",
       " 34: 446,\n",
       " 35: 452,\n",
       " 36: 453,\n",
       " 37: 480,\n",
       " 38: 488,\n",
       " 39: 499,\n",
       " 40: 515,\n",
       " 41: 539,\n",
       " 42: 540,\n",
       " 43: 568,\n",
       " 44: 576,\n",
       " 45: 577,\n",
       " 46: 592,\n",
       " 47: 596,\n",
       " 48: 643,\n",
       " 49: 656,\n",
       " 50: 658,\n",
       " 51: 683,\n",
       " 52: 686,\n",
       " 53: 694,\n",
       " 54: 699,\n",
       " 55: 714,\n",
       " 56: 761,\n",
       " 57: 788,\n",
       " 58: 791,\n",
       " 59: 832,\n",
       " 60: 864,\n",
       " 61: 959,\n",
       " 62: 1003,\n",
       " 63: 1010,\n",
       " 64: 1029,\n",
       " 65: 1038,\n",
       " 66: 1074,\n",
       " 67: 1089,\n",
       " 68: 1149,\n",
       " 69: 1163,\n",
       " 70: 1192,\n",
       " 71: 1200,\n",
       " 72: 1202,\n",
       " 73: 1209,\n",
       " 74: 1210,\n",
       " 75: 1229,\n",
       " 76: 1232,\n",
       " 77: 1235,\n",
       " 78: 1249,\n",
       " 79: 1327,\n",
       " 80: 1336,\n",
       " 81: 1343,\n",
       " 82: 1384,\n",
       " 83: 1427,\n",
       " 84: 1454,\n",
       " 85: 1456,\n",
       " 86: 1498,\n",
       " 87: 1505,\n",
       " 88: 1514,\n",
       " 89: 1541,\n",
       " 90: 1585,\n",
       " 91: 1643,\n",
       " 92: 1722,\n",
       " 93: 1724,\n",
       " 94: 1775,\n",
       " 95: 1818,\n",
       " 96: 1845,\n",
       " 97: 1853,\n",
       " 98: 1866,\n",
       " 99: 1881,\n",
       " 100: 1900,\n",
       " 101: 1905,\n",
       " 102: 1956,\n",
       " 103: 1958,\n",
       " 104: 2014,\n",
       " 105: 2025,\n",
       " 106: 2055,\n",
       " 107: 2075,\n",
       " 108: 5,\n",
       " 109: 34,\n",
       " 110: 43,\n",
       " 111: 103,\n",
       " 112: 184,\n",
       " 113: 194,\n",
       " 114: 243,\n",
       " 115: 315,\n",
       " 116: 358,\n",
       " 117: 366,\n",
       " 118: 398,\n",
       " 119: 407,\n",
       " 120: 426,\n",
       " 121: 434,\n",
       " 122: 440,\n",
       " 123: 460,\n",
       " 124: 490,\n",
       " 125: 606,\n",
       " 126: 628,\n",
       " 127: 635,\n",
       " 128: 647,\n",
       " 129: 697,\n",
       " 130: 718,\n",
       " 131: 756,\n",
       " 132: 765,\n",
       " 133: 802,\n",
       " 134: 813,\n",
       " 135: 837,\n",
       " 136: 893,\n",
       " 137: 896,\n",
       " 138: 925,\n",
       " 139: 928,\n",
       " 140: 968,\n",
       " 141: 990,\n",
       " 142: 997,\n",
       " 143: 1006,\n",
       " 144: 1049,\n",
       " 145: 1050,\n",
       " 146: 1075,\n",
       " 147: 1098,\n",
       " 148: 1102,\n",
       " 149: 1130,\n",
       " 150: 1133,\n",
       " 151: 1173,\n",
       " 152: 1225,\n",
       " 153: 1234,\n",
       " 154: 1239,\n",
       " 155: 1265,\n",
       " 156: 1383,\n",
       " 157: 1491,\n",
       " 158: 1496,\n",
       " 159: 1587,\n",
       " 160: 1674,\n",
       " 161: 1691,\n",
       " 162: 1747,\n",
       " 163: 1785,\n",
       " 164: 1798,\n",
       " 165: 1801,\n",
       " 166: 1832,\n",
       " 167: 1836,\n",
       " 168: 1885,\n",
       " 169: 1926,\n",
       " 170: 1992,\n",
       " 171: 2032,\n",
       " 172: 2047,\n",
       " 173: 2080,\n",
       " 174: 7,\n",
       " 175: 13,\n",
       " 176: 21,\n",
       " 177: 24,\n",
       " 178: 25,\n",
       " 179: 29,\n",
       " 180: 31,\n",
       " 181: 48,\n",
       " 182: 53,\n",
       " 183: 54,\n",
       " 184: 72,\n",
       " 185: 75,\n",
       " 186: 95,\n",
       " 187: 98,\n",
       " 188: 110,\n",
       " 189: 126,\n",
       " 190: 129,\n",
       " 191: 130,\n",
       " 192: 132,\n",
       " 193: 134,\n",
       " 194: 135,\n",
       " 195: 136,\n",
       " 196: 137,\n",
       " 197: 144,\n",
       " 198: 147,\n",
       " 199: 209,\n",
       " 200: 214,\n",
       " 201: 227,\n",
       " 202: 230,\n",
       " 203: 232,\n",
       " 204: 233,\n",
       " 205: 240,\n",
       " 206: 252,\n",
       " 207: 253,\n",
       " 208: 256,\n",
       " 209: 271,\n",
       " 210: 278,\n",
       " 211: 299,\n",
       " 212: 302,\n",
       " 213: 305,\n",
       " 214: 310,\n",
       " 215: 327,\n",
       " 216: 329,\n",
       " 217: 332,\n",
       " 218: 333,\n",
       " 219: 335,\n",
       " 220: 339,\n",
       " 221: 340,\n",
       " 222: 346,\n",
       " 223: 350,\n",
       " 224: 357,\n",
       " 225: 361,\n",
       " 226: 390,\n",
       " 227: 400,\n",
       " 228: 405,\n",
       " 229: 413,\n",
       " 230: 414,\n",
       " 231: 415,\n",
       " 232: 417,\n",
       " 233: 420,\n",
       " 234: 421,\n",
       " 235: 425,\n",
       " 236: 458,\n",
       " 237: 470,\n",
       " 238: 472,\n",
       " 239: 477,\n",
       " 240: 479,\n",
       " 241: 481,\n",
       " 242: 494,\n",
       " 243: 495,\n",
       " 244: 497,\n",
       " 245: 498,\n",
       " 246: 501,\n",
       " 247: 502,\n",
       " 248: 503,\n",
       " 249: 518,\n",
       " 250: 520,\n",
       " 251: 527,\n",
       " 252: 531,\n",
       " 253: 535,\n",
       " 254: 538,\n",
       " 255: 569,\n",
       " 256: 571,\n",
       " 257: 572,\n",
       " 258: 581,\n",
       " 259: 584,\n",
       " 260: 598,\n",
       " 261: 604,\n",
       " 262: 609,\n",
       " 263: 612,\n",
       " 264: 617,\n",
       " 265: 621,\n",
       " 266: 632,\n",
       " 267: 636,\n",
       " 268: 638,\n",
       " 269: 651,\n",
       " 270: 659,\n",
       " 271: 670,\n",
       " 272: 674,\n",
       " 273: 675,\n",
       " 274: 679,\n",
       " 275: 680,\n",
       " 276: 682,\n",
       " 277: 688,\n",
       " 278: 689,\n",
       " 279: 690,\n",
       " 280: 703,\n",
       " 281: 713,\n",
       " 282: 717,\n",
       " 283: 722,\n",
       " 284: 723,\n",
       " 285: 730,\n",
       " 286: 732,\n",
       " 287: 735,\n",
       " 288: 749,\n",
       " 289: 777,\n",
       " 290: 778,\n",
       " 291: 793,\n",
       " 292: 795,\n",
       " 293: 808,\n",
       " 294: 816,\n",
       " 295: 836,\n",
       " 296: 850,\n",
       " 297: 851,\n",
       " 298: 852,\n",
       " 299: 853,\n",
       " 300: 859,\n",
       " 301: 873,\n",
       " 302: 885,\n",
       " 303: 898,\n",
       " 304: 905,\n",
       " 305: 909,\n",
       " 306: 910,\n",
       " 307: 954,\n",
       " 308: 955,\n",
       " 309: 963,\n",
       " 310: 965,\n",
       " 311: 966,\n",
       " 312: 985,\n",
       " 313: 1002,\n",
       " 314: 1017,\n",
       " 315: 1023,\n",
       " 316: 1027,\n",
       " 317: 1033,\n",
       " 318: 1046,\n",
       " 319: 1053,\n",
       " 320: 1057,\n",
       " 321: 1069,\n",
       " 322: 1071,\n",
       " 323: 1092,\n",
       " 324: 1104,\n",
       " 325: 1106,\n",
       " 326: 1109,\n",
       " 327: 1120,\n",
       " 328: 1132,\n",
       " 329: 1135,\n",
       " 330: 1136,\n",
       " 331: 1137,\n",
       " 332: 1171,\n",
       " 333: 1184,\n",
       " 334: 1185,\n",
       " 335: 1186,\n",
       " 336: 1188,\n",
       " 337: 1189,\n",
       " 338: 1197,\n",
       " 339: 1198,\n",
       " 340: 1226,\n",
       " 341: 1233,\n",
       " 342: 1246,\n",
       " 343: 1247,\n",
       " 344: 1253,\n",
       " 345: 1255,\n",
       " 346: 1263,\n",
       " 347: 1272,\n",
       " 348: 1280,\n",
       " 349: 1291,\n",
       " 350: 1299,\n",
       " 351: 1300,\n",
       " 352: 1301,\n",
       " 353: 1305,\n",
       " 354: 1308,\n",
       " 355: 1356,\n",
       " 356: 1365,\n",
       " 357: 1379,\n",
       " 358: 1389,\n",
       " 359: 1399,\n",
       " 360: 1413,\n",
       " 361: 1431,\n",
       " 362: 1435,\n",
       " 363: 1445,\n",
       " 364: 1447,\n",
       " 365: 1462,\n",
       " 366: 1466,\n",
       " 367: 1471,\n",
       " 368: 1478,\n",
       " 369: 1485,\n",
       " 370: 1489,\n",
       " 371: 1517,\n",
       " 372: 1528,\n",
       " 373: 1532,\n",
       " 374: 1533,\n",
       " 375: 1540,\n",
       " 376: 1555,\n",
       " 377: 1563,\n",
       " 378: 1564,\n",
       " 379: 1572,\n",
       " 380: 1590,\n",
       " 381: 1600,\n",
       " 382: 1605,\n",
       " 383: 1606,\n",
       " 384: 1607,\n",
       " 385: 1608,\n",
       " 386: 1616,\n",
       " 387: 1621,\n",
       " 388: 1628,\n",
       " 389: 1633,\n",
       " 390: 1648,\n",
       " 391: 1659,\n",
       " 392: 1663,\n",
       " 393: 1666,\n",
       " 394: 1690,\n",
       " 395: 1715,\n",
       " 396: 1717,\n",
       " 397: 1726,\n",
       " 398: 1730,\n",
       " 399: 1736,\n",
       " 400: 1741,\n",
       " 401: 1742,\n",
       " 402: 1753,\n",
       " 403: 1757,\n",
       " 404: 1765,\n",
       " 405: 1766,\n",
       " 406: 1771,\n",
       " 407: 1780,\n",
       " 408: 1790,\n",
       " 409: 1791,\n",
       " 410: 1795,\n",
       " 411: 1808,\n",
       " 412: 1813,\n",
       " 413: 1820,\n",
       " 414: 1821,\n",
       " 415: 1828,\n",
       " 416: 1829,\n",
       " 417: 1838,\n",
       " 418: 1850,\n",
       " 419: 1856,\n",
       " 420: 1869,\n",
       " 421: 1873,\n",
       " 422: 1880,\n",
       " 423: 1895,\n",
       " 424: 1903,\n",
       " 425: 1908,\n",
       " 426: 1909,\n",
       " 427: 1910,\n",
       " 428: 1915,\n",
       " 429: 1928,\n",
       " 430: 1946,\n",
       " 431: 1959,\n",
       " 432: 1965,\n",
       " 433: 1973,\n",
       " 434: 1979,\n",
       " 435: 1983,\n",
       " 436: 1988,\n",
       " 437: 2018,\n",
       " 438: 2021,\n",
       " 439: 2027,\n",
       " 440: 2031,\n",
       " 441: 2033,\n",
       " 442: 2040,\n",
       " 443: 2056,\n",
       " 444: 2058,\n",
       " 445: 2068,\n",
       " 446: 2087,\n",
       " 447: 2088,\n",
       " 448: 17,\n",
       " 449: 18,\n",
       " 450: 20,\n",
       " 451: 33,\n",
       " 452: 50,\n",
       " 453: 59,\n",
       " 454: 101,\n",
       " 455: 123,\n",
       " 456: 125,\n",
       " 457: 161,\n",
       " 458: 180,\n",
       " 459: 193,\n",
       " 460: 216,\n",
       " 461: 234,\n",
       " 462: 250,\n",
       " 463: 280,\n",
       " 464: 303,\n",
       " 465: 345,\n",
       " 466: 383,\n",
       " 467: 385,\n",
       " 468: 386,\n",
       " 469: 393,\n",
       " 470: 396,\n",
       " 471: 418,\n",
       " 472: 465,\n",
       " 473: 482,\n",
       " 474: 496,\n",
       " 475: 556,\n",
       " 476: 560,\n",
       " 477: 605,\n",
       " 478: 639,\n",
       " 479: 665,\n",
       " 480: 672,\n",
       " 481: 705,\n",
       " 482: 741,\n",
       " 483: 746,\n",
       " 484: 780,\n",
       " 485: 846,\n",
       " 486: 863,\n",
       " 487: 889,\n",
       " 488: 914,\n",
       " 489: 943,\n",
       " 490: 960,\n",
       " 491: 982,\n",
       " 492: 1001,\n",
       " 493: 1012,\n",
       " 494: 1040,\n",
       " 495: 1052,\n",
       " 496: 1062,\n",
       " 497: 1084,\n",
       " 498: 1099,\n",
       " 499: 1107,\n",
       " 500: 1147,\n",
       " 501: 1155,\n",
       " 502: 1187,\n",
       " 503: 1190,\n",
       " 504: 1191,\n",
       " 505: 1194,\n",
       " 506: 1212,\n",
       " 507: 1273,\n",
       " 508: 1282,\n",
       " 509: 1295,\n",
       " 510: 1321,\n",
       " 511: 1350,\n",
       " 512: 1395,\n",
       " 513: 1422,\n",
       " 514: 1441,\n",
       " 515: 1450,\n",
       " 516: 1453,\n",
       " 517: 1469,\n",
       " 518: 1470,\n",
       " 519: 1472,\n",
       " 520: 1474,\n",
       " 521: 1480,\n",
       " 522: 1503,\n",
       " 523: 1504,\n",
       " 524: 1508,\n",
       " 525: 1522,\n",
       " 526: 1539,\n",
       " 527: 1542,\n",
       " 528: 1562,\n",
       " 529: 1565,\n",
       " 530: 1579,\n",
       " 531: 1591,\n",
       " 532: 1597,\n",
       " 533: 1620,\n",
       " 534: 1642,\n",
       " 535: 1656,\n",
       " 536: 1658,\n",
       " 537: 1685,\n",
       " 538: 1692,\n",
       " 539: 1706,\n",
       " 540: 1740,\n",
       " 541: 1752,\n",
       " 542: 1755,\n",
       " 543: 1760,\n",
       " 544: 1772,\n",
       " 545: 1783,\n",
       " 546: 1793,\n",
       " 547: 1835,\n",
       " 548: 1842,\n",
       " 549: 1877,\n",
       " 550: 1920,\n",
       " 551: 1933,\n",
       " 552: 1942,\n",
       " 553: 1974,\n",
       " 554: 1993,\n",
       " 555: 1996,\n",
       " 556: 2008,\n",
       " 557: 2017,\n",
       " 558: 2029,\n",
       " 559: 2038,\n",
       " 560: 2057,\n",
       " 561: 2091,\n",
       " 562: 2097,\n",
       " 563: 311,\n",
       " 564: 320,\n",
       " 565: 352,\n",
       " 566: 370,\n",
       " 567: 375,\n",
       " 568: 441,\n",
       " 569: 543,\n",
       " 570: 565,\n",
       " 571: 611,\n",
       " 572: 691,\n",
       " 573: 806,\n",
       " 574: 919,\n",
       " 575: 922,\n",
       " 576: 994,\n",
       " 577: 1035,\n",
       " 578: 1065,\n",
       " 579: 1097,\n",
       " 580: 1219,\n",
       " 581: 1220,\n",
       " 582: 1261,\n",
       " 583: 1275,\n",
       " 584: 1520,\n",
       " 585: 1534,\n",
       " 586: 1636,\n",
       " 587: 1637,\n",
       " 588: 1732,\n",
       " 589: 1746,\n",
       " 590: 2016,\n",
       " 591: 2028,\n",
       " 592: 2059,\n",
       " 593: 94,\n",
       " 594: 183,\n",
       " 595: 455,\n",
       " 596: 530,\n",
       " 597: 566,\n",
       " 598: 625,\n",
       " 599: 710,\n",
       " 600: 728,\n",
       " 601: 799,\n",
       " 602: 855,\n",
       " 603: 940,\n",
       " 604: 1036,\n",
       " 605: 1067,\n",
       " 606: 1148,\n",
       " 607: 1152,\n",
       " 608: 1153,\n",
       " 609: 1211,\n",
       " 610: 1223,\n",
       " 611: 1244,\n",
       " 612: 1518,\n",
       " 613: 1545,\n",
       " 614: 1595,\n",
       " 615: 1689,\n",
       " 616: 1728,\n",
       " 617: 1855,\n",
       " 618: 1950,\n",
       " 619: 1962,\n",
       " 620: 1964,\n",
       " 621: 1991,\n",
       " 622: 1994,\n",
       " 623: 159,\n",
       " 624: 336,\n",
       " 625: 342,\n",
       " 626: 513,\n",
       " 627: 1103,\n",
       " 628: 1164,\n",
       " 629: 1313,\n",
       " 630: 1459,\n",
       " 631: 1464,\n",
       " 632: 1624,\n",
       " 633: 1630,\n",
       " 634: 1669,\n",
       " 635: 1817,\n",
       " 636: 1947,\n",
       " 637: 2003,\n",
       " 638: 2006,\n",
       " 639: 2030,\n",
       " 640: 42,\n",
       " 641: 55,\n",
       " 642: 61,\n",
       " 643: 68,\n",
       " 644: 99,\n",
       " 645: 100,\n",
       " 646: 120,\n",
       " 647: 124,\n",
       " 648: 140,\n",
       " 649: 151,\n",
       " 650: 156,\n",
       " 651: 171,\n",
       " 652: 174,\n",
       " 653: 200,\n",
       " 654: 218,\n",
       " 655: 236,\n",
       " 656: 244,\n",
       " 657: 285,\n",
       " 658: 288,\n",
       " 659: 289,\n",
       " 660: 304,\n",
       " 661: 326,\n",
       " 662: 328,\n",
       " 663: 347,\n",
       " 664: 355,\n",
       " 665: 362,\n",
       " 666: 392,\n",
       " 667: 427,\n",
       " 668: 431,\n",
       " 669: 456,\n",
       " 670: 461,\n",
       " 671: 464,\n",
       " 672: 468,\n",
       " 673: 475,\n",
       " 674: 511,\n",
       " 675: 544,\n",
       " 676: 551,\n",
       " 677: 567,\n",
       " 678: 580,\n",
       " 679: 585,\n",
       " 680: 587,\n",
       " 681: 601,\n",
       " 682: 629,\n",
       " 683: 631,\n",
       " 684: 633,\n",
       " 685: 634,\n",
       " 686: 644,\n",
       " 687: 654,\n",
       " 688: 662,\n",
       " 689: 668,\n",
       " 690: 673,\n",
       " 691: 678,\n",
       " 692: 695,\n",
       " 693: 716,\n",
       " 694: 729,\n",
       " 695: 733,\n",
       " 696: 758,\n",
       " 697: 762,\n",
       " 698: 763,\n",
       " 699: 767,\n",
       " 700: 771,\n",
       " 701: 784,\n",
       " 702: 794,\n",
       " 703: 805,\n",
       " 704: 818,\n",
       " 705: 821,\n",
       " 706: 824,\n",
       " 707: 830,\n",
       " 708: 841,\n",
       " 709: 849,\n",
       " 710: 871,\n",
       " 711: 881,\n",
       " 712: 900,\n",
       " 713: 904,\n",
       " 714: 913,\n",
       " 715: 917,\n",
       " 716: 929,\n",
       " 717: 941,\n",
       " 718: 967,\n",
       " 719: 971,\n",
       " 720: 975,\n",
       " 721: 991,\n",
       " 722: 999,\n",
       " 723: 1008,\n",
       " 724: 1015,\n",
       " 725: 1019,\n",
       " 726: 1022,\n",
       " 727: 1041,\n",
       " 728: 1042,\n",
       " 729: 1056,\n",
       " 730: 1070,\n",
       " 731: 1083,\n",
       " 732: 1093,\n",
       " 733: 1094,\n",
       " 734: 1111,\n",
       " 735: 1114,\n",
       " 736: 1134,\n",
       " 737: 1146,\n",
       " 738: 1151,\n",
       " 739: 1156,\n",
       " 740: 1159,\n",
       " 741: 1165,\n",
       " 742: 1179,\n",
       " 743: 1180,\n",
       " 744: 1215,\n",
       " 745: 1256,\n",
       " 746: 1264,\n",
       " 747: 1267,\n",
       " 748: 1270,\n",
       " 749: 1277,\n",
       " 750: 1278,\n",
       " 751: 1279,\n",
       " 752: 1292,\n",
       " 753: 1302,\n",
       " 754: 1319,\n",
       " 755: 1329,\n",
       " 756: 1333,\n",
       " 757: 1339,\n",
       " 758: 1372,\n",
       " 759: 1380,\n",
       " 760: 1381,\n",
       " 761: 1382,\n",
       " 762: 1387,\n",
       " 763: 1394,\n",
       " 764: 1407,\n",
       " 765: 1411,\n",
       " 766: 1414,\n",
       " 767: 1419,\n",
       " 768: 1424,\n",
       " 769: 1430,\n",
       " 770: 1433,\n",
       " 771: 1434,\n",
       " 772: 1437,\n",
       " 773: 1449,\n",
       " 774: 1486,\n",
       " 775: 1492,\n",
       " 776: 1494,\n",
       " 777: 1509,\n",
       " 778: 1519,\n",
       " 779: 1530,\n",
       " 780: 1538,\n",
       " 781: 1546,\n",
       " 782: 1583,\n",
       " 783: 1589,\n",
       " 784: 1594,\n",
       " 785: 1614,\n",
       " 786: 1629,\n",
       " 787: 1635,\n",
       " 788: 1647,\n",
       " 789: 1667,\n",
       " 790: 1676,\n",
       " 791: 1682,\n",
       " 792: 1684,\n",
       " 793: 1688,\n",
       " 794: 1705,\n",
       " 795: 1708,\n",
       " 796: 1712,\n",
       " 797: 1727,\n",
       " 798: 1778,\n",
       " 799: 1781,\n",
       " 800: 1784,\n",
       " 801: 1789,\n",
       " 802: 1797,\n",
       " 803: 1802,\n",
       " 804: 1814,\n",
       " 805: 1815,\n",
       " 806: 1823,\n",
       " 807: 1830,\n",
       " 808: 1831,\n",
       " 809: 1840,\n",
       " 810: 1844,\n",
       " 811: 1875,\n",
       " 812: 1888,\n",
       " 813: 1892,\n",
       " 814: 1898,\n",
       " 815: 1906,\n",
       " 816: 1911,\n",
       " 817: 1918,\n",
       " 818: 1922,\n",
       " 819: 1924,\n",
       " 820: 1931,\n",
       " 821: 1954,\n",
       " 822: 1955,\n",
       " 823: 1966,\n",
       " 824: 1969,\n",
       " 825: 1977,\n",
       " 826: 1980,\n",
       " 827: 1981,\n",
       " 828: 1982,\n",
       " 829: 1987,\n",
       " 830: 1997,\n",
       " 831: 1998,\n",
       " 832: 2010,\n",
       " 833: 2013,\n",
       " 834: 2019,\n",
       " 835: 2023,\n",
       " 836: 2024,\n",
       " 837: 2039,\n",
       " 838: 2042,\n",
       " 839: 2044,\n",
       " 840: 2062,\n",
       " 841: 2084,\n",
       " 842: 11,\n",
       " 843: 44,\n",
       " 844: 58,\n",
       " 845: 87,\n",
       " 846: 92,\n",
       " 847: 133,\n",
       " 848: 146,\n",
       " 849: 162,\n",
       " 850: 179,\n",
       " 851: 190,\n",
       " 852: 210,\n",
       " 853: 226,\n",
       " 854: 231,\n",
       " 855: 242,\n",
       " 856: 260,\n",
       " 857: 286,\n",
       " 858: 301,\n",
       " 859: 318,\n",
       " 860: 330,\n",
       " 861: 378,\n",
       " 862: 380,\n",
       " 863: 387,\n",
       " 864: 403,\n",
       " 865: 409,\n",
       " 866: 412,\n",
       " 867: 466,\n",
       " 868: 474,\n",
       " 869: 484,\n",
       " 870: 514,\n",
       " 871: 533,\n",
       " 872: 534,\n",
       " 873: 536,\n",
       " 874: 575,\n",
       " 875: 620,\n",
       " 876: 650,\n",
       " 877: 660,\n",
       " 878: 667,\n",
       " 879: 684,\n",
       " 880: 685,\n",
       " 881: 698,\n",
       " 882: 702,\n",
       " 883: 743,\n",
       " 884: 753,\n",
       " 885: 759,\n",
       " 886: 770,\n",
       " 887: 779,\n",
       " 888: 801,\n",
       " 889: 804,\n",
       " 890: 809,\n",
       " 891: 831,\n",
       " 892: 858,\n",
       " 893: 875,\n",
       " 894: 906,\n",
       " 895: 911,\n",
       " 896: 916,\n",
       " 897: 952,\n",
       " 898: 969,\n",
       " 899: 984,\n",
       " 900: 987,\n",
       " 901: 989,\n",
       " 902: 1026,\n",
       " 903: 1072,\n",
       " 904: 1080,\n",
       " 905: 1124,\n",
       " 906: 1139,\n",
       " 907: 1172,\n",
       " 908: 1222,\n",
       " 909: 1231,\n",
       " 910: 1237,\n",
       " 911: 1288,\n",
       " 912: 1298,\n",
       " 913: 1316,\n",
       " 914: 1318,\n",
       " 915: 1332,\n",
       " 916: 1337,\n",
       " 917: 1401,\n",
       " 918: 1423,\n",
       " 919: 1455,\n",
       " 920: 1458,\n",
       " 921: 1511,\n",
       " 922: 1516,\n",
       " 923: 1524,\n",
       " 924: 1544,\n",
       " 925: 1558,\n",
       " 926: 1560,\n",
       " 927: 1577,\n",
       " 928: 1578,\n",
       " 929: 1652,\n",
       " 930: 1653,\n",
       " 931: 1662,\n",
       " 932: 1678,\n",
       " 933: 1686,\n",
       " 934: 1762,\n",
       " 935: 1776,\n",
       " 936: 1811,\n",
       " 937: 1871,\n",
       " 938: 1894,\n",
       " 939: 1963,\n",
       " 940: 2000,\n",
       " 941: 2034,\n",
       " 942: 2037,\n",
       " 943: 2041,\n",
       " 944: 2053,\n",
       " 945: 2071,\n",
       " 946: 2076,\n",
       " 947: 307,\n",
       " 948: 325,\n",
       " 949: 559,\n",
       " 950: 773,\n",
       " 951: 786,\n",
       " 952: 868,\n",
       " 953: 1349,\n",
       " 954: 1352,\n",
       " 955: 1604,\n",
       " 956: 1641,\n",
       " 957: 2078,\n",
       " 958: 8,\n",
       " 959: 149,\n",
       " 960: 158,\n",
       " 961: 201,\n",
       " 962: 938,\n",
       " 963: 1294,\n",
       " 964: 1374,\n",
       " 965: 1570,\n",
       " 966: 1639,\n",
       " 967: 1677,\n",
       " 968: 1680,\n",
       " 969: 1833,\n",
       " 970: 1995,\n",
       " 971: 12,\n",
       " 972: 23,\n",
       " 973: 32,\n",
       " 974: 56,\n",
       " 975: 257,\n",
       " 976: 262,\n",
       " 977: 274,\n",
       " 978: 316,\n",
       " 979: 371,\n",
       " 980: 424,\n",
       " 981: 442,\n",
       " 982: 476,\n",
       " 983: 516,\n",
       " 984: 519,\n",
       " 985: 557,\n",
       " 986: 624,\n",
       " 987: 666,\n",
       " 988: 706,\n",
       " 989: 725,\n",
       " 990: 838,\n",
       " 991: 865,\n",
       " 992: 886,\n",
       " 993: 897,\n",
       " 994: 907,\n",
       " 995: 935,\n",
       " 996: 950,\n",
       " 997: 977,\n",
       " 998: 1021,\n",
       " 999: 1087,\n",
       " ...}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "index_to_user_id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "da78911b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#加入到原始数据中\n",
    "data['name_index'] = data['name'].apply(lambda x:name_to_index[x])  #将data中的name映射到数字\n",
    "data['user_index'] = data['userID'].apply(lambda x:user_id_to_index[x])  #将data中的uerID映射到数字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "32a7403e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>userID</th>\n",
       "      <th>weight</th>\n",
       "      <th>name</th>\n",
       "      <th>name_index</th>\n",
       "      <th>user_index</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>13883</td>\n",
       "      <td>Duran Duran</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4</td>\n",
       "      <td>228</td>\n",
       "      <td>Duran Duran</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>27</td>\n",
       "      <td>85</td>\n",
       "      <td>Duran Duran</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>28</td>\n",
       "      <td>10</td>\n",
       "      <td>Duran Duran</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>62</td>\n",
       "      <td>528</td>\n",
       "      <td>Duran Duran</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63763</th>\n",
       "      <td>1998</td>\n",
       "      <td>255</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "      <td>316</td>\n",
       "      <td>831</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63764</th>\n",
       "      <td>2017</td>\n",
       "      <td>2690</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "      <td>316</td>\n",
       "      <td>557</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63765</th>\n",
       "      <td>2033</td>\n",
       "      <td>175</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "      <td>316</td>\n",
       "      <td>441</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63766</th>\n",
       "      <td>2076</td>\n",
       "      <td>203</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "      <td>316</td>\n",
       "      <td>946</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63767</th>\n",
       "      <td>2084</td>\n",
       "      <td>288</td>\n",
       "      <td>Cansei de Ser Sexy</td>\n",
       "      <td>316</td>\n",
       "      <td>841</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>37891 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       userID  weight                name  name_index  user_index\n",
       "0           2   13883         Duran Duran           0           0\n",
       "1           4     228         Duran Duran           0           1\n",
       "2          27      85         Duran Duran           0           2\n",
       "3          28      10         Duran Duran           0           3\n",
       "4          62     528         Duran Duran           0           4\n",
       "...       ...     ...                 ...         ...         ...\n",
       "63763    1998     255  Cansei de Ser Sexy         316         831\n",
       "63764    2017    2690  Cansei de Ser Sexy         316         557\n",
       "63765    2033     175  Cansei de Ser Sexy         316         441\n",
       "63766    2076     203  Cansei de Ser Sexy         316         946\n",
       "63767    2084     288  Cansei de Ser Sexy         316         841\n",
       "\n",
       "[37891 rows x 5 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e0c677f",
   "metadata": {},
   "source": [
    "3.对数据进行转换-构建用户音乐的矩阵-透视表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "38a57411",
   "metadata": {},
   "outputs": [],
   "source": [
    "n_users = len(user_id_to_index)  #获取用户数量\n",
    "n_artists = len(name_to_index)   #获取音乐数量\n",
    "ratings_matrix = np.zeros((n_users,n_artists))  #创建用户-音乐评分矩阵\n",
    "for row in data.itertuples():   #itertuples返回的元组的第一个元素是行的索引，其余元素是行中的数据\n",
    "#     print(row[5])\n",
    "    #row[5]可以直接row.属性，比如row.name、row.user_index\n",
    "    ratings_matrix[row[5],row[4]] = row[1] #将data中的评分填入用户-音乐矩阵中  row[5]用户名  row[4]音乐名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "ed31ad49",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 2.,  2.,  2., ...,  0.,  0.,  0.],\n",
       "       [ 4.,  4.,  0., ...,  0.,  0.,  0.],\n",
       "       [27.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       ...,\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.]])"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratings_matrix"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "64e9f0cd",
   "metadata": {},
   "source": [
    "4.计算用户之间的相关性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "d655d8c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算用户之间的相似度\n",
    "from sklearn.metrics.pairwise import cosine_similarity   #导入sklearn库中的余弦相似度计算函数\n",
    "user_similarity = cosine_similarity(ratings_matrix)  #计算用户之间的相似度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "dab3e848",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.        , 0.30618622, 0.1118034 , ..., 0.        , 0.        ,\n",
       "        0.        ],\n",
       "       [0.30618622, 1.        , 0.13693064, ..., 0.        , 0.        ,\n",
       "        0.        ],\n",
       "       [0.1118034 , 0.13693064, 1.        , ..., 0.        , 0.        ,\n",
       "        0.        ],\n",
       "       ...,\n",
       "       [0.        , 0.        , 0.        , ..., 1.        , 0.        ,\n",
       "        0.        ],\n",
       "       [0.        , 0.        , 0.        , ..., 0.        , 1.        ,\n",
       "        0.        ],\n",
       "       [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "        1.        ]])"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_similarity"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "203f5942",
   "metadata": {},
   "source": [
    "5.推荐音乐"
   ]
  },
  {
   "cell_type": "raw",
   "id": "b48c8133",
   "metadata": {},
   "source": [
    "1.取出用户和哪些用户相似\n",
    "2.再取出这些相似用户都听过哪些音乐\n",
    "3.再用相似用户音乐和用户听过的音乐对比，只向用户推荐没有听过的音乐"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "fc856fbe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([   2,  762, 1010, ..., 1189, 1168, 1796], dtype=int64)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user_index = 2  #设置用户索引    为这个用户推荐音乐\n",
    "indexa = np.argsort(-user_similarity[user_index])\n",
    "indexa"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "cb633264",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 762, 1010,  944, ..., 1189, 1168, 1796], dtype=int64)"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "indexa[indexa != 2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "934592cb",
   "metadata": {},
   "outputs": [],
   "source": [
    "#为用户推荐音乐\n",
    "user_index = 2  #设置用户索引    为这个用户推荐音乐\n",
    "# 找出相似用户\n",
    "# 分步求\n",
    "#index_u = np.argsort(-user_similarity[user_index])   #np.argsort：排序，但是返回的是数据的下标\n",
    "#index_u[index_u != 2]   #找出相似用户肯定要除掉自己\n",
    "#合着求\n",
    "similar_user = np.argsort(-user_similarity[user_index])[1:] #获取与用户索引为2的用户最相似的用户索引  负号加与不加代表升序降序 [1:]：去掉自己"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "16e47d10",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 762, 1010,  944, ..., 1189, 1168, 1796], dtype=int64)"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "similar_user"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "45a010d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 2.,  2.,  2., ...,  0.,  0.,  0.],\n",
       "       [ 4.,  4.,  0., ...,  0.,  0.,  0.],\n",
       "       [27.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       ...,\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.],\n",
       "       [ 0.,  0.,  0., ...,  0.,  0.,  0.]])"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratings_matrix"
   ]
  },
  {
   "cell_type": "raw",
   "id": "0c21afba",
   "metadata": {},
   "source": [
    "np.where(condition, x, y) 当 where 内有三个参数时,第一个参数表示条件,当条件成立时 where 方法返回 x,当条件不成立时 where 返回 y np.where(condition) 当 where 内只有一个参数时,那个参数表示条件,当条件成立时,where 返回的是每个符合 condition 条件元素的坐标,返回的是以元组的形式 多条件时 condition,& 表示与,|表示或"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "ad285e57",
   "metadata": {},
   "outputs": [],
   "source": [
    "recommended_artists = [] #创建推荐音乐列表\n",
    "for i in similar_user:  #遍历相似用户\n",
    "    artists_rated = np.where(ratings_matrix[i] > 0)[0]  # 获取相似用户评分的音乐,要选出相似用户听过的，也就是评分>0\n",
    "    for j in artists_rated:  #遍历音乐索引\n",
    "        if ratings_matrix[user_index][j] == 0: #用户未评分  推荐给用户的肯定是用户没有听过的，也就是评分为0的音乐\n",
    "            recommended_artists.append((j,ratings_matrix[i][j])) #将音乐加入推荐音乐列表  (j,ratings_matrix[i][j]):(音乐,评分)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "579e9e1f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(7, 1387.0),\n",
       " (32, 1387.0),\n",
       " (68, 1387.0),\n",
       " (129, 1387.0),\n",
       " (133, 1387.0),\n",
       " (150, 1387.0),\n",
       " (183, 1387.0),\n",
       " (250, 1387.0),\n",
       " (275, 1387.0),\n",
       " (277, 1387.0),\n",
       " (313, 1387.0),\n",
       " (11, 1502.0),\n",
       " (13, 1502.0),\n",
       " (20, 1502.0),\n",
       " (34, 1502.0),\n",
       " (55, 1502.0),\n",
       " (56, 1502.0),\n",
       " (70, 1502.0),\n",
       " (253, 1502.0),\n",
       " (14, 2053.0),\n",
       " (103, 2053.0),\n",
       " (104, 2053.0),\n",
       " (130, 2053.0),\n",
       " (140, 2053.0),\n",
       " (141, 2053.0),\n",
       " (145, 2053.0),\n",
       " (208, 2053.0),\n",
       " (210, 2053.0),\n",
       " (227, 2053.0),\n",
       " (228, 2053.0),\n",
       " (245, 2053.0),\n",
       " (254, 2053.0),\n",
       " (304, 2053.0),\n",
       " (2, 1910.0),\n",
       " (4, 1910.0),\n",
       " (9, 1910.0),\n",
       " (14, 1910.0),\n",
       " (25, 1910.0),\n",
       " (44, 1910.0),\n",
       " (52, 1910.0),\n",
       " (70, 1910.0),\n",
       " (80, 1910.0),\n",
       " (112, 1910.0),\n",
       " (115, 1910.0),\n",
       " (151, 1910.0),\n",
       " (170, 1910.0),\n",
       " (184, 1910.0),\n",
       " (250, 1910.0),\n",
       " (252, 1910.0),\n",
       " (267, 1910.0),\n",
       " (278, 1910.0),\n",
       " (279, 1910.0),\n",
       " (295, 1910.0),\n",
       " (302, 1910.0),\n",
       " (308, 1910.0),\n",
       " (313, 1910.0),\n",
       " (22, 44.0),\n",
       " (31, 44.0),\n",
       " (49, 44.0),\n",
       " (50, 44.0),\n",
       " (55, 44.0),\n",
       " (109, 44.0),\n",
       " (117, 44.0),\n",
       " (165, 44.0),\n",
       " (170, 44.0),\n",
       " (188, 44.0),\n",
       " (189, 44.0),\n",
       " (194, 44.0),\n",
       " (200, 44.0),\n",
       " (212, 44.0),\n",
       " (216, 44.0),\n",
       " (225, 44.0),\n",
       " (259, 44.0),\n",
       " (261, 44.0),\n",
       " (273, 44.0),\n",
       " (283, 44.0),\n",
       " (284, 44.0),\n",
       " (285, 44.0),\n",
       " (286, 44.0),\n",
       " (2, 481.0),\n",
       " (7, 481.0),\n",
       " (14, 481.0),\n",
       " (17, 481.0),\n",
       " (50, 481.0),\n",
       " (62, 481.0),\n",
       " (65, 481.0),\n",
       " (68, 481.0),\n",
       " (72, 481.0),\n",
       " (76, 481.0),\n",
       " (86, 481.0),\n",
       " (112, 481.0),\n",
       " (137, 481.0),\n",
       " (147, 481.0),\n",
       " (148, 481.0),\n",
       " (149, 481.0),\n",
       " (151, 481.0),\n",
       " (166, 481.0),\n",
       " (175, 481.0),\n",
       " (176, 481.0),\n",
       " (182, 481.0),\n",
       " (187, 481.0),\n",
       " (202, 481.0),\n",
       " (217, 481.0),\n",
       " (218, 481.0),\n",
       " (238, 481.0),\n",
       " (241, 481.0),\n",
       " (242, 481.0),\n",
       " (251, 481.0),\n",
       " (252, 481.0),\n",
       " (267, 481.0),\n",
       " (307, 481.0),\n",
       " (313, 481.0),\n",
       " (316, 481.0),\n",
       " (7, 1688.0),\n",
       " (12, 1688.0),\n",
       " (17, 1688.0),\n",
       " (25, 1688.0),\n",
       " (38, 1688.0),\n",
       " (56, 1688.0),\n",
       " (80, 1688.0),\n",
       " (148, 1688.0),\n",
       " (172, 1688.0),\n",
       " (182, 1688.0),\n",
       " (184, 1688.0),\n",
       " (202, 1688.0),\n",
       " (252, 1688.0),\n",
       " (257, 1688.0),\n",
       " (302, 1688.0),\n",
       " (308, 1688.0),\n",
       " (314, 1688.0),\n",
       " (19, 1401.0),\n",
       " (57, 1401.0),\n",
       " (61, 1401.0),\n",
       " (64, 1401.0),\n",
       " (68, 1401.0),\n",
       " (76, 1401.0),\n",
       " (89, 1401.0),\n",
       " (91, 1401.0),\n",
       " (92, 1401.0),\n",
       " (93, 1401.0),\n",
       " (99, 1401.0),\n",
       " (103, 1401.0),\n",
       " (147, 1401.0),\n",
       " (148, 1401.0),\n",
       " (155, 1401.0),\n",
       " (161, 1401.0),\n",
       " (188, 1401.0),\n",
       " (14, 2020.0),\n",
       " (19, 2020.0),\n",
       " (31, 2020.0),\n",
       " (35, 2020.0),\n",
       " (40, 2020.0),\n",
       " (51, 2020.0),\n",
       " (55, 2020.0),\n",
       " (61, 2020.0),\n",
       " (68, 2020.0),\n",
       " (72, 2020.0),\n",
       " (93, 2020.0),\n",
       " (95, 2020.0),\n",
       " (112, 2020.0),\n",
       " (119, 2020.0),\n",
       " (120, 2020.0),\n",
       " (133, 2020.0),\n",
       " (137, 2020.0),\n",
       " (148, 2020.0),\n",
       " (166, 2020.0),\n",
       " (187, 2020.0),\n",
       " (190, 2020.0),\n",
       " (203, 2020.0),\n",
       " (210, 2020.0),\n",
       " (252, 2020.0),\n",
       " (279, 2020.0),\n",
       " (281, 2020.0),\n",
       " (306, 2020.0),\n",
       " (70, 1425.0),\n",
       " (115, 1425.0),\n",
       " (148, 1425.0),\n",
       " (151, 1425.0),\n",
       " (182, 1425.0),\n",
       " (202, 1425.0),\n",
       " (256, 1425.0),\n",
       " (302, 1425.0),\n",
       " (306, 1425.0),\n",
       " (313, 1425.0),\n",
       " (314, 1425.0),\n",
       " (4, 352.0),\n",
       " (14, 352.0),\n",
       " (52, 352.0),\n",
       " (61, 352.0),\n",
       " (62, 352.0),\n",
       " (65, 352.0),\n",
       " (66, 352.0),\n",
       " (68, 352.0),\n",
       " (72, 352.0),\n",
       " (74, 352.0),\n",
       " (76, 352.0),\n",
       " (95, 352.0),\n",
       " (98, 352.0),\n",
       " (117, 352.0),\n",
       " (127, 352.0),\n",
       " (137, 352.0),\n",
       " (151, 352.0),\n",
       " (155, 352.0),\n",
       " (157, 352.0),\n",
       " (160, 352.0),\n",
       " (161, 352.0),\n",
       " (175, 352.0),\n",
       " (176, 352.0),\n",
       " (177, 352.0),\n",
       " (187, 352.0),\n",
       " (240, 352.0),\n",
       " (263, 352.0),\n",
       " (288, 352.0),\n",
       " (305, 352.0),\n",
       " (261, 860.0),\n",
       " (273, 860.0),\n",
       " (7, 673.0),\n",
       " (13, 673.0),\n",
       " (102, 673.0),\n",
       " (104, 673.0),\n",
       " (107, 673.0),\n",
       " (129, 673.0),\n",
       " (134, 673.0),\n",
       " (188, 673.0),\n",
       " (189, 673.0),\n",
       " (245, 673.0),\n",
       " (290, 673.0),\n",
       " (297, 673.0),\n",
       " (17, 817.0),\n",
       " (20, 817.0),\n",
       " (43, 817.0),\n",
       " (49, 817.0),\n",
       " (52, 817.0),\n",
       " (53, 817.0),\n",
       " (86, 817.0),\n",
       " (131, 817.0),\n",
       " (134, 817.0),\n",
       " (141, 817.0),\n",
       " (142, 817.0),\n",
       " (152, 817.0),\n",
       " (178, 817.0),\n",
       " (212, 817.0),\n",
       " (230, 817.0),\n",
       " (275, 817.0),\n",
       " (276, 817.0),\n",
       " (277, 817.0),\n",
       " (290, 817.0),\n",
       " (293, 817.0),\n",
       " (33, 96.0),\n",
       " (45, 96.0),\n",
       " (61, 96.0),\n",
       " (62, 96.0),\n",
       " (68, 96.0),\n",
       " (77, 96.0),\n",
       " (80, 96.0),\n",
       " (94, 96.0),\n",
       " (99, 96.0),\n",
       " (142, 96.0),\n",
       " (157, 96.0),\n",
       " (289, 96.0),\n",
       " (11, 1172.0),\n",
       " (22, 1172.0),\n",
       " (26, 1172.0),\n",
       " (62, 1172.0),\n",
       " (72, 1172.0),\n",
       " (104, 1172.0),\n",
       " (142, 1172.0),\n",
       " (145, 1172.0),\n",
       " (219, 1172.0),\n",
       " (226, 1172.0),\n",
       " (228, 1172.0),\n",
       " (256, 1172.0),\n",
       " (7, 2044.0),\n",
       " (17, 2044.0),\n",
       " (36, 2044.0),\n",
       " (39, 2044.0),\n",
       " (44, 2044.0),\n",
       " (54, 2044.0),\n",
       " (109, 2044.0),\n",
       " (170, 2044.0),\n",
       " (172, 2044.0),\n",
       " (184, 2044.0),\n",
       " (252, 2044.0),\n",
       " (286, 2044.0),\n",
       " (2, 129.0),\n",
       " (10, 129.0),\n",
       " (14, 129.0),\n",
       " (58, 129.0),\n",
       " (59, 129.0),\n",
       " (61, 129.0),\n",
       " (62, 129.0),\n",
       " (65, 129.0),\n",
       " (66, 129.0),\n",
       " (67, 129.0),\n",
       " (68, 129.0),\n",
       " (69, 129.0),\n",
       " (71, 129.0),\n",
       " (72, 129.0),\n",
       " (74, 129.0),\n",
       " (75, 129.0),\n",
       " (85, 129.0),\n",
       " (87, 129.0),\n",
       " (95, 129.0),\n",
       " (98, 129.0),\n",
       " (100, 129.0),\n",
       " (124, 129.0),\n",
       " (126, 129.0),\n",
       " (127, 129.0),\n",
       " (146, 129.0),\n",
       " (147, 129.0),\n",
       " (161, 129.0),\n",
       " (179, 129.0),\n",
       " (182, 129.0),\n",
       " (187, 129.0),\n",
       " (220, 129.0),\n",
       " (288, 129.0),\n",
       " (2, 1291.0),\n",
       " (50, 1291.0),\n",
       " (57, 1291.0),\n",
       " (58, 1291.0),\n",
       " (59, 1291.0),\n",
       " (60, 1291.0),\n",
       " (118, 1291.0),\n",
       " (223, 1291.0),\n",
       " (252, 1291.0),\n",
       " (267, 1291.0),\n",
       " (279, 1291.0),\n",
       " (299, 1291.0),\n",
       " (308, 1291.0),\n",
       " (14, 759.0),\n",
       " (17, 759.0),\n",
       " (25, 759.0),\n",
       " (31, 759.0),\n",
       " (32, 759.0),\n",
       " (37, 759.0),\n",
       " (39, 759.0),\n",
       " (40, 759.0),\n",
       " (46, 759.0),\n",
       " (50, 759.0),\n",
       " (52, 759.0),\n",
       " (70, 759.0),\n",
       " (74, 759.0),\n",
       " (91, 759.0),\n",
       " (112, 759.0),\n",
       " (114, 759.0),\n",
       " (120, 759.0),\n",
       " (142, 759.0),\n",
       " (148, 759.0),\n",
       " (154, 759.0),\n",
       " (157, 759.0),\n",
       " (161, 759.0),\n",
       " (166, 759.0),\n",
       " (178, 759.0),\n",
       " (202, 759.0),\n",
       " (214, 759.0),\n",
       " (250, 759.0),\n",
       " (251, 759.0),\n",
       " (255, 759.0),\n",
       " (267, 759.0),\n",
       " (279, 759.0),\n",
       " (295, 759.0),\n",
       " (306, 759.0),\n",
       " (7, 871.0),\n",
       " (20, 871.0),\n",
       " (22, 871.0),\n",
       " (25, 871.0),\n",
       " (30, 871.0),\n",
       " (48, 871.0),\n",
       " (49, 871.0),\n",
       " (50, 871.0),\n",
       " (54, 871.0),\n",
       " (80, 871.0),\n",
       " (117, 871.0),\n",
       " (120, 871.0),\n",
       " (143, 871.0),\n",
       " (189, 871.0),\n",
       " (208, 871.0),\n",
       " (225, 871.0),\n",
       " (226, 871.0),\n",
       " (257, 871.0),\n",
       " (258, 871.0),\n",
       " (261, 871.0),\n",
       " (272, 871.0),\n",
       " (283, 871.0),\n",
       " (314, 871.0),\n",
       " (1, 1587.0),\n",
       " (2, 1587.0),\n",
       " (9, 1587.0),\n",
       " (17, 1587.0),\n",
       " (22, 1587.0),\n",
       " (25, 1587.0),\n",
       " (27, 1587.0),\n",
       " (44, 1587.0),\n",
       " (46, 1587.0),\n",
       " (48, 1587.0),\n",
       " (52, 1587.0),\n",
       " (157, 1587.0),\n",
       " (248, 1587.0),\n",
       " (258, 1587.0),\n",
       " (295, 1587.0),\n",
       " (1, 184.0),\n",
       " (6, 184.0),\n",
       " (9, 184.0),\n",
       " (11, 184.0),\n",
       " (12, 184.0),\n",
       " (14, 184.0),\n",
       " (17, 184.0),\n",
       " (22, 184.0),\n",
       " (23, 184.0),\n",
       " (25, 184.0),\n",
       " (27, 184.0),\n",
       " (31, 184.0),\n",
       " (56, 184.0),\n",
       " (104, 184.0),\n",
       " (109, 184.0),\n",
       " (145, 184.0),\n",
       " (202, 184.0),\n",
       " (228, 184.0),\n",
       " (252, 184.0),\n",
       " (254, 184.0),\n",
       " (256, 184.0),\n",
       " (267, 184.0),\n",
       " (281, 184.0),\n",
       " (302, 184.0),\n",
       " (314, 184.0),\n",
       " (5, 530.0),\n",
       " (11, 530.0),\n",
       " (12, 530.0),\n",
       " (27, 530.0),\n",
       " (51, 530.0),\n",
       " (108, 530.0),\n",
       " (148, 530.0),\n",
       " (255, 530.0),\n",
       " (2, 1659.0),\n",
       " (14, 1659.0),\n",
       " (62, 1659.0),\n",
       " (65, 1659.0),\n",
       " (66, 1659.0),\n",
       " (68, 1659.0),\n",
       " (70, 1659.0),\n",
       " (72, 1659.0),\n",
       " (87, 1659.0),\n",
       " (100, 1659.0),\n",
       " (127, 1659.0),\n",
       " (149, 1659.0),\n",
       " (204, 1659.0),\n",
       " (205, 1659.0),\n",
       " (219, 1659.0),\n",
       " (238, 1659.0),\n",
       " (35, 1733.0),\n",
       " (49, 1733.0),\n",
       " (53, 1733.0),\n",
       " (55, 1733.0),\n",
       " (139, 1733.0),\n",
       " (189, 1733.0),\n",
       " (206, 1733.0),\n",
       " (208, 1733.0),\n",
       " (209, 1733.0),\n",
       " (227, 1733.0),\n",
       " (253, 1733.0),\n",
       " (257, 1733.0),\n",
       " (259, 1733.0),\n",
       " (272, 1733.0),\n",
       " (273, 1733.0),\n",
       " (303, 1733.0),\n",
       " (2, 1715.0),\n",
       " (10, 1715.0),\n",
       " (12, 1715.0),\n",
       " (14, 1715.0),\n",
       " (15, 1715.0),\n",
       " (25, 1715.0),\n",
       " (61, 1715.0),\n",
       " (62, 1715.0),\n",
       " (68, 1715.0),\n",
       " (74, 1715.0),\n",
       " (80, 1715.0),\n",
       " (104, 1715.0),\n",
       " (118, 1715.0),\n",
       " (148, 1715.0),\n",
       " (151, 1715.0),\n",
       " (157, 1715.0),\n",
       " (159, 1715.0),\n",
       " (187, 1715.0),\n",
       " (191, 1715.0),\n",
       " (219, 1715.0),\n",
       " (252, 1715.0),\n",
       " (267, 1715.0),\n",
       " (275, 1715.0),\n",
       " (278, 1715.0),\n",
       " (286, 1715.0),\n",
       " (302, 1715.0),\n",
       " (313, 1715.0),\n",
       " (2, 1722.0),\n",
       " (7, 1722.0),\n",
       " (14, 1722.0),\n",
       " (15, 1722.0),\n",
       " (18, 1722.0),\n",
       " (21, 1722.0),\n",
       " (61, 1722.0),\n",
       " (62, 1722.0),\n",
       " (67, 1722.0),\n",
       " (68, 1722.0),\n",
       " (71, 1722.0),\n",
       " (72, 1722.0),\n",
       " (73, 1722.0),\n",
       " (74, 1722.0),\n",
       " (76, 1722.0),\n",
       " (77, 1722.0),\n",
       " (80, 1722.0),\n",
       " (89, 1722.0),\n",
       " (91, 1722.0),\n",
       " (94, 1722.0),\n",
       " (100, 1722.0),\n",
       " (127, 1722.0),\n",
       " (152, 1722.0),\n",
       " (154, 1722.0),\n",
       " (157, 1722.0),\n",
       " (221, 1722.0),\n",
       " (267, 1722.0),\n",
       " (31, 649.0),\n",
       " (35, 649.0),\n",
       " (45, 649.0),\n",
       " (103, 649.0),\n",
       " (139, 649.0),\n",
       " (140, 649.0),\n",
       " (141, 649.0),\n",
       " (189, 649.0),\n",
       " (206, 649.0),\n",
       " (209, 649.0),\n",
       " (225, 649.0),\n",
       " (226, 649.0),\n",
       " (228, 649.0),\n",
       " (264, 649.0),\n",
       " (271, 649.0),\n",
       " (274, 649.0),\n",
       " (301, 649.0),\n",
       " (7, 1866.0),\n",
       " (14, 1866.0),\n",
       " (31, 1866.0),\n",
       " (33, 1866.0),\n",
       " (50, 1866.0),\n",
       " (54, 1866.0),\n",
       " (55, 1866.0),\n",
       " (103, 1866.0),\n",
       " (143, 1866.0),\n",
       " (153, 1866.0),\n",
       " (158, 1866.0),\n",
       " (210, 1866.0),\n",
       " (212, 1866.0),\n",
       " (214, 1866.0),\n",
       " (254, 1866.0),\n",
       " (259, 1866.0),\n",
       " (269, 1866.0),\n",
       " (7, 1546.0),\n",
       " (11, 1546.0),\n",
       " (13, 1546.0),\n",
       " (14, 1546.0),\n",
       " (17, 1546.0),\n",
       " (20, 1546.0),\n",
       " (25, 1546.0),\n",
       " (31, 1546.0),\n",
       " (37, 1546.0),\n",
       " (40, 1546.0),\n",
       " (42, 1546.0),\n",
       " (44, 1546.0),\n",
       " (48, 1546.0),\n",
       " (49, 1546.0),\n",
       " (52, 1546.0),\n",
       " (68, 1546.0),\n",
       " (70, 1546.0),\n",
       " (111, 1546.0),\n",
       " (112, 1546.0),\n",
       " (114, 1546.0),\n",
       " (117, 1546.0),\n",
       " (118, 1546.0),\n",
       " (156, 1546.0),\n",
       " (176, 1546.0),\n",
       " (193, 1546.0),\n",
       " (219, 1546.0),\n",
       " (251, 1546.0),\n",
       " (257, 1546.0),\n",
       " (2, 340.0),\n",
       " (14, 340.0),\n",
       " (50, 340.0),\n",
       " (55, 340.0),\n",
       " (57, 340.0),\n",
       " (58, 340.0),\n",
       " (61, 340.0),\n",
       " (62, 340.0),\n",
       " (65, 340.0),\n",
       " (68, 340.0),\n",
       " (71, 340.0),\n",
       " (72, 340.0),\n",
       " (74, 340.0),\n",
       " (76, 340.0),\n",
       " (83, 340.0),\n",
       " (95, 340.0),\n",
       " (98, 340.0),\n",
       " (112, 340.0),\n",
       " (123, 340.0),\n",
       " (124, 340.0),\n",
       " (127, 340.0),\n",
       " (145, 340.0),\n",
       " (147, 340.0),\n",
       " (153, 340.0),\n",
       " (216, 340.0),\n",
       " (219, 340.0),\n",
       " (221, 340.0),\n",
       " (283, 340.0),\n",
       " (5, 1956.0),\n",
       " (14, 1956.0),\n",
       " (19, 1956.0),\n",
       " (29, 1956.0),\n",
       " (62, 1956.0),\n",
       " (68, 1956.0),\n",
       " (142, 1956.0),\n",
       " (238, 1956.0),\n",
       " (252, 1956.0),\n",
       " (2, 675.0),\n",
       " (14, 675.0),\n",
       " (58, 675.0),\n",
       " (61, 675.0),\n",
       " (62, 675.0),\n",
       " (63, 675.0),\n",
       " (65, 675.0),\n",
       " (67, 675.0),\n",
       " (68, 675.0),\n",
       " (69, 675.0),\n",
       " (71, 675.0),\n",
       " (72, 675.0),\n",
       " (73, 675.0),\n",
       " (76, 675.0),\n",
       " (85, 675.0),\n",
       " (99, 675.0),\n",
       " (100, 675.0),\n",
       " (112, 675.0),\n",
       " (127, 675.0),\n",
       " (151, 675.0),\n",
       " (154, 675.0),\n",
       " (161, 675.0),\n",
       " (175, 675.0),\n",
       " (184, 675.0),\n",
       " (220, 675.0),\n",
       " (238, 675.0),\n",
       " (302, 675.0),\n",
       " (307, 675.0),\n",
       " (313, 675.0),\n",
       " (10, 969.0),\n",
       " (22, 969.0),\n",
       " (23, 969.0),\n",
       " (31, 969.0),\n",
       " (40, 969.0),\n",
       " (50, 969.0),\n",
       " (52, 969.0),\n",
       " (53, 969.0),\n",
       " (62, 969.0),\n",
       " (65, 969.0),\n",
       " (70, 969.0),\n",
       " (72, 969.0),\n",
       " (76, 969.0),\n",
       " (80, 969.0),\n",
       " (95, 969.0),\n",
       " (98, 969.0),\n",
       " (104, 969.0),\n",
       " (137, 969.0),\n",
       " (146, 969.0),\n",
       " (155, 969.0),\n",
       " (159, 969.0),\n",
       " (191, 969.0),\n",
       " (228, 969.0),\n",
       " (254, 969.0),\n",
       " (281, 969.0),\n",
       " (282, 969.0),\n",
       " (289, 969.0),\n",
       " (308, 969.0),\n",
       " (316, 969.0),\n",
       " (5, 1728.0),\n",
       " (7, 1728.0),\n",
       " (11, 1728.0),\n",
       " (12, 1728.0),\n",
       " (17, 1728.0),\n",
       " (25, 1728.0),\n",
       " (27, 1728.0),\n",
       " (29, 1728.0),\n",
       " (31, 1728.0),\n",
       " (55, 1728.0),\n",
       " (109, 1728.0),\n",
       " (120, 1728.0),\n",
       " (152, 1728.0),\n",
       " (215, 1728.0),\n",
       " (251, 1728.0),\n",
       " (252, 1728.0),\n",
       " (286, 1728.0),\n",
       " (298, 1728.0),\n",
       " (2, 1185.0),\n",
       " (4, 1185.0),\n",
       " (6, 1185.0),\n",
       " (7, 1185.0),\n",
       " (12, 1185.0),\n",
       " (15, 1185.0),\n",
       " (17, 1185.0),\n",
       " (27, 1185.0),\n",
       " (36, 1185.0),\n",
       " (51, 1185.0),\n",
       " (62, 1185.0),\n",
       " (68, 1185.0),\n",
       " (70, 1185.0),\n",
       " (182, 1185.0),\n",
       " (184, 1185.0),\n",
       " (295, 1185.0),\n",
       " (302, 1185.0),\n",
       " (313, 1185.0),\n",
       " (314, 1185.0),\n",
       " (5, 1210.0),\n",
       " (11, 1210.0),\n",
       " (18, 1210.0),\n",
       " (19, 1210.0),\n",
       " (20, 1210.0),\n",
       " (29, 1210.0),\n",
       " (31, 1210.0),\n",
       " (33, 1210.0),\n",
       " (50, 1210.0),\n",
       " (142, 1210.0),\n",
       " (152, 1210.0),\n",
       " (166, 1210.0),\n",
       " (198, 1210.0),\n",
       " (230, 1210.0),\n",
       " (238, 1210.0),\n",
       " (239, 1210.0),\n",
       " (260, 1210.0),\n",
       " (309, 1210.0),\n",
       " (312, 1210.0),\n",
       " (2, 836.0),\n",
       " (4, 836.0),\n",
       " (19, 836.0),\n",
       " (21, 836.0),\n",
       " (58, 836.0),\n",
       " (59, 836.0),\n",
       " (60, 836.0),\n",
       " (65, 836.0),\n",
       " (67, 836.0),\n",
       " (71, 836.0),\n",
       " (73, 836.0),\n",
       " (74, 836.0),\n",
       " (76, 836.0),\n",
       " (80, 836.0),\n",
       " (91, 836.0),\n",
       " (147, 836.0),\n",
       " (153, 836.0),\n",
       " (184, 836.0),\n",
       " (299, 836.0),\n",
       " (1, 243.0),\n",
       " (2, 243.0),\n",
       " (4, 243.0),\n",
       " (6, 243.0),\n",
       " (7, 243.0),\n",
       " (9, 243.0),\n",
       " (10, 243.0),\n",
       " (11, 243.0),\n",
       " (12, 243.0),\n",
       " (14, 243.0),\n",
       " (15, 243.0),\n",
       " (18, 243.0),\n",
       " (56, 243.0),\n",
       " (61, 243.0),\n",
       " (65, 243.0),\n",
       " (68, 243.0),\n",
       " (69, 243.0),\n",
       " (70, 243.0),\n",
       " (73, 243.0),\n",
       " (80, 243.0),\n",
       " (112, 243.0),\n",
       " (151, 243.0),\n",
       " (153, 243.0),\n",
       " (162, 243.0),\n",
       " (184, 243.0),\n",
       " (220, 243.0),\n",
       " (238, 243.0),\n",
       " (252, 243.0),\n",
       " (278, 243.0),\n",
       " (306, 243.0),\n",
       " (313, 243.0),\n",
       " (22, 828.0),\n",
       " (26, 828.0),\n",
       " (198, 828.0),\n",
       " (211, 828.0),\n",
       " (226, 828.0),\n",
       " (230, 828.0),\n",
       " (271, 828.0),\n",
       " (273, 828.0),\n",
       " (274, 828.0),\n",
       " (283, 828.0),\n",
       " (21, 2000.0),\n",
       " (61, 2000.0),\n",
       " (62, 2000.0),\n",
       " (67, 2000.0),\n",
       " (91, 2000.0),\n",
       " (92, 2000.0),\n",
       " (93, 2000.0),\n",
       " (128, 2000.0),\n",
       " (130, 2000.0),\n",
       " (221, 2000.0),\n",
       " (6, 1817.0),\n",
       " (19, 1817.0),\n",
       " (27, 1817.0),\n",
       " (103, 1817.0),\n",
       " (112, 1817.0),\n",
       " (162, 1817.0),\n",
       " (251, 1817.0),\n",
       " (252, 1817.0),\n",
       " (306, 1817.0),\n",
       " (313, 1817.0),\n",
       " (3, 17.0),\n",
       " (14, 17.0),\n",
       " (52, 17.0),\n",
       " (53, 17.0),\n",
       " (61, 17.0),\n",
       " (62, 17.0),\n",
       " (65, 17.0),\n",
       " (70, 17.0),\n",
       " (72, 17.0),\n",
       " (76, 17.0),\n",
       " (86, 17.0),\n",
       " (87, 17.0),\n",
       " (98, 17.0),\n",
       " (106, 17.0),\n",
       " (124, 17.0),\n",
       " (125, 17.0),\n",
       " (127, 17.0),\n",
       " (137, 17.0),\n",
       " (148, 17.0),\n",
       " (149, 17.0),\n",
       " (157, 17.0),\n",
       " (161, 17.0),\n",
       " (175, 17.0),\n",
       " (176, 17.0),\n",
       " (177, 17.0),\n",
       " (178, 17.0),\n",
       " (179, 17.0),\n",
       " (180, 17.0),\n",
       " (182, 17.0),\n",
       " (183, 17.0),\n",
       " (184, 17.0),\n",
       " (187, 17.0),\n",
       " (28, 1061.0),\n",
       " (45, 1061.0),\n",
       " (197, 1061.0),\n",
       " (310, 1061.0),\n",
       " (29, 1408.0),\n",
       " (62, 1408.0),\n",
       " (130, 1408.0),\n",
       " (249, 1408.0),\n",
       " (17, 948.0),\n",
       " (31, 948.0),\n",
       " (36, 948.0),\n",
       " (108, 948.0),\n",
       " (133, 1442.0),\n",
       " (139, 1442.0),\n",
       " (140, 1442.0),\n",
       " (206, 1442.0),\n",
       " (7, 2039.0),\n",
       " (11, 2039.0),\n",
       " (17, 2039.0),\n",
       " (25, 2039.0),\n",
       " (27, 2039.0),\n",
       " (28, 2039.0),\n",
       " (51, 2039.0),\n",
       " (56, 2039.0),\n",
       " (73, 2039.0),\n",
       " (77, 2039.0),\n",
       " (80, 2039.0),\n",
       " (137, 2039.0),\n",
       " (142, 2039.0),\n",
       " (157, 2039.0),\n",
       " (184, 2039.0),\n",
       " (192, 2039.0),\n",
       " (223, 2039.0),\n",
       " (252, 2039.0),\n",
       " (253, 2039.0),\n",
       " (275, 2039.0),\n",
       " (95, 182.0),\n",
       " (98, 182.0),\n",
       " (219, 182.0),\n",
       " (299, 182.0),\n",
       " (7, 1042.0),\n",
       " (14, 1042.0),\n",
       " (18, 1042.0),\n",
       " (32, 1042.0),\n",
       " (51, 1042.0),\n",
       " (62, 1042.0),\n",
       " (64, 1042.0),\n",
       " (65, 1042.0),\n",
       " (67, 1042.0),\n",
       " (68, 1042.0),\n",
       " (72, 1042.0),\n",
       " (74, 1042.0),\n",
       " (75, 1042.0),\n",
       " (82, 1042.0),\n",
       " (86, 1042.0),\n",
       " (87, 1042.0),\n",
       " (88, 1042.0),\n",
       " (91, 1042.0),\n",
       " (95, 1042.0),\n",
       " (99, 1042.0),\n",
       " (106, 1042.0),\n",
       " (124, 1042.0),\n",
       " (125, 1042.0),\n",
       " (126, 1042.0),\n",
       " (127, 1042.0),\n",
       " (130, 1042.0),\n",
       " (137, 1042.0),\n",
       " (158, 1042.0),\n",
       " (179, 1042.0),\n",
       " (221, 1042.0),\n",
       " (244, 1042.0),\n",
       " (269, 1042.0),\n",
       " (287, 1042.0),\n",
       " (129, 616.0),\n",
       " (140, 616.0),\n",
       " (189, 616.0),\n",
       " (208, 616.0),\n",
       " (209, 616.0),\n",
       " (225, 616.0),\n",
       " (226, 616.0),\n",
       " (245, 616.0),\n",
       " (261, 616.0),\n",
       " (272, 616.0),\n",
       " (297, 616.0),\n",
       " (2, 761.0),\n",
       " (3, 761.0),\n",
       " (4, 761.0),\n",
       " (5, 761.0),\n",
       " (9, 761.0),\n",
       " (11, 761.0),\n",
       " (20, 761.0),\n",
       " (74, 761.0),\n",
       " (166, 761.0),\n",
       " (239, 761.0),\n",
       " (253, 761.0),\n",
       " (1, 925.0),\n",
       " (11, 925.0),\n",
       " (17, 925.0),\n",
       " (25, 925.0),\n",
       " (38, 925.0),\n",
       " (50, 925.0),\n",
       " (52, 925.0),\n",
       " (54, 925.0),\n",
       " (56, 925.0),\n",
       " (80, 925.0),\n",
       " (152, 925.0),\n",
       " (166, 925.0),\n",
       " (175, 925.0),\n",
       " (178, 925.0),\n",
       " (184, 925.0),\n",
       " (216, 925.0),\n",
       " (252, 925.0),\n",
       " (258, 925.0),\n",
       " (261, 925.0),\n",
       " (268, 925.0),\n",
       " (312, 925.0),\n",
       " (11, 977.0),\n",
       " (17, 977.0),\n",
       " (25, 977.0),\n",
       " (31, 977.0),\n",
       " (37, 977.0),\n",
       " (43, 977.0),\n",
       " (45, 977.0),\n",
       " (47, 977.0),\n",
       " (50, 977.0),\n",
       " (51, 977.0),\n",
       " (53, 977.0),\n",
       " (80, 977.0),\n",
       " (103, 977.0),\n",
       " (142, 977.0),\n",
       " (153, 977.0),\n",
       " (167, 977.0),\n",
       " (192, 977.0),\n",
       " (199, 977.0),\n",
       " (213, 977.0),\n",
       " (229, 977.0),\n",
       " (289, 977.0),\n",
       " (1, 1384.0),\n",
       " (6, 1384.0),\n",
       " (7, 1384.0),\n",
       " (10, 1384.0),\n",
       " (14, 1384.0),\n",
       " (27, 1384.0),\n",
       " (37, 1384.0),\n",
       " (45, 1384.0),\n",
       " (52, 1384.0),\n",
       " (53, 1384.0),\n",
       " (55, 1384.0),\n",
       " (136, 1384.0),\n",
       " (147, 1384.0),\n",
       " (152, 1384.0),\n",
       " (153, 1384.0),\n",
       " (178, 1384.0),\n",
       " (197, 1384.0),\n",
       " (211, 1384.0),\n",
       " (265, 1384.0),\n",
       " ...]"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "recommended_artists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "ec090862",
   "metadata": {},
   "outputs": [],
   "source": [
    "recommended_artists = sorted(recommended_artists,key=lambda x:x[1],reverse=True)[:10]  #筛选出前10个"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "fd820334",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(208, 2100.0),\n",
       " (256, 2100.0),\n",
       " (201, 2099.0),\n",
       " (3, 2097.0),\n",
       " (5, 2097.0),\n",
       " (11, 2097.0),\n",
       " (12, 2097.0),\n",
       " (17, 2097.0),\n",
       " (20, 2097.0),\n",
       " (22, 2097.0)]"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "recommended_artists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "6b5dc10f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Slayer\n",
      "Yann Tiersen\n",
      "Boards of Canada\n",
      "Daft Punk\n",
      "New Order\n",
      "Depeche Mode\n",
      "Portishead\n",
      "Radiohead\n",
      "The Cure\n",
      "Pink Floyd\n"
     ]
    }
   ],
   "source": [
    "# 找出索引对应原本的音乐名，并打印\n",
    "for artist in recommended_artists: #遍历推荐音乐\n",
    "    print(artists[artists['name'] == index_to_name[artist[0]]]['name'].values[0]) #打印推荐音乐"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "098c00a2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8d54358",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
